-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[regression/7.0.81] label created dynamically in code doesn't stretch like it should #14588
Comments
+1 this... [M]ulti-Platform [A]pp [U]ser [I]ssues continues to grow |
Suspect this is a duplicate of #14537 |
Seems likely, but it's impossible to say for sure without knowing the OP's Grid structure. #14537 is about controls spanning Grid columns, and the code shown here doesn't set any column spans. We need a repro, or at the very least we need to know what the Grid looks like. |
Hi @vsfeedback. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate. |
Hello, I'm the one who posted that feedback. What do you need? |
@Phil11111 In order to know if it's the same bug as #14537, we would need to know what your Grid code/markup looks like. (I'm assuming there's a Grid involved because your |
Hi @vsfeedback. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
Yes, you are right, the collection views are within a Grid. Basically it is an empty Grid at first that I pass as a command parameter for a command, I then populate the Gris in code when the command is fired. <Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="255"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<VerticalStackLayout Grid.Row="0">
<Grid IsVisible="{Binding isGameStarted, Converter={StaticResource InvertedBoolConverter}}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Margin="0,5" Grid.Row="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Text="{Binding CardsRequired}" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"/>
<Entry Text="{Binding Name}" Placeholder="Nom de joueur" Grid.Column="0" Grid.Row="1"/>
<Button Text="Ajout Joueur" Command="{Binding AddPlayerCommand}" Grid.Column="1" Grid.Row="1"/>
</Grid>
<CollectionView ItemsSource="{Binding Joueurs}" Grid.Row="1">
<CollectionView.ItemTemplate>
<DataTemplate>
<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="Supprime" BackgroundColor="red"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:MainPageViewModel}}, Path=DeletePlayerCommand}"
CommandParameter="{Binding .}"/>
</SwipeItems>
</SwipeView.RightItems>
<SwipeView.LeftItems>
<SwipeItems>
<SwipeItem Text="Modifie" BackgroundColor="Blue"
Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:MainPageViewModel}}, Path=ModifyPlayerCommand}"
CommandParameter="{Binding .}"/>
</SwipeItems>
</SwipeView.LeftItems>
<Grid Margin="0,1">
<Border>
<Border.StrokeShape>
<RoundRectangle CornerRadius="10" />
</Border.StrokeShape>
<Label Text="{Binding Name}" Margin="5, 10"/>
</Border>
</Grid>
</SwipeView>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<Button Text="Commencer la partie" Command="{Binding StartGameCommand}" CommandParameter="{Binding Source={x:Reference GameScoreDisplayGrid}}" Grid.Row="2" Margin="0,10,0,0"/>
</Grid>
<Button Text="Ronde Finie" Command="{Binding RoundFinishedCommand}">
<Button.IsVisible>
<MultiBinding Converter="{StaticResource BooleanAndConverter}">
<Binding Path="isGameStarted"/>
<Binding Path="isPlayersPlaying"/>
<Binding Path="isPlayersEnteringLevee" Converter="{StaticResource InvertedBoolConverter}"/>
</MultiBinding>
</Button.IsVisible>
</Button>
<Button Text="Passer à la ronde suivante" Command="{Binding NextRoundCommand}">
<Button.IsVisible>
<MultiBinding Converter="{StaticResource BooleanAndConverter}">
<Binding Path="isGameStarted"/>
<Binding Path="isPlayersPlaying" Converter="{StaticResource InvertedBoolConverter}"/>
<Binding Path="isPlayersChoosingLevee" Converter="{StaticResource InvertedBoolConverter}"/>
<Binding Path="isPlayersEnteringLevee" Converter="{StaticResource InvertedBoolConverter}"/>
</MultiBinding>
</Button.IsVisible>
</Button>
<Grid>
<Grid.IsVisible>
<MultiBinding Converter="{StaticResource BooleanOrConverter}">
<Binding Path="isPlayersChoosingLevee"/>
<Binding Path="isPlayersEnteringLevee"/>
</MultiBinding>
</Grid.IsVisible>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Text="{Binding UserInputMessage}" Grid.Row="0"/>
<CollectionView ItemsLayout="VerticalGrid, 4" ItemsSource="{Binding ButtonChoices}" IsVisible="{Binding isPlayersChoosingLevee}" Grid.Row="1">
<CollectionView.ItemTemplate>
<DataTemplate>
<Button Text="{Binding .}" Margin="1" Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:MainPageViewModel}}, Path=InputAskedLeveeCommand}" CommandParameter="{Binding .}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<CollectionView ItemsLayout="VerticalGrid, 4" ItemsSource="{Binding ButtonChoices}" IsVisible="{Binding isPlayersEnteringLevee}" Grid.Row="1">
<CollectionView.ItemTemplate>
<DataTemplate>
<Button Text="{Binding .}" Margin="1" Command="{Binding Source={RelativeSource AncestorType={x:Type viewmodels:MainPageViewModel}}, Path=InputDoneLeveeCommand}" CommandParameter="{Binding .}"/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</Grid>
<!--<Label Text="{Binding isGameStarted, StringFormat='IsGameStarted: {0}'}"/>-->
<!--<Label Text="{Binding isPlayersPlaying, StringFormat='isPlayersPlaying: {0}'}"/>-->
<!--<Label Text="{Binding isPlayersChoosingLevee, StringFormat='isPlayersChoosingLevee: {0}'}"/>-->
<!--<Label Text="{Binding isPlayersEnteringLevee, StringFormat='isPlayersEnteringLevee: {0}'}"/>-->
<!--<Button Text="test button" Command="{Binding TestCommand}" CommandParameter="{Binding Source={x:Reference UserInputFlexLayout}}"/>-->
<!--<Label Text="{Binding teststring}"/>-->
</VerticalStackLayout>
<StackLayout Grid.Row="2">
<Button Text="Aide" Command="{Binding HelpCommand}"/>
<!--This Button quit the App-->
<Button Text="Quitter" Command="{Binding QuitAppCommand}" Margin="0,20,0,0"/>
</StackLayout>
</Grid>
<!--This Grid contains the element for displaying the data, elements are added programmatically-->
<Grid x:Name="GameScoreDisplayGrid" Grid.Column="1"/>
</Grid> |
Hi @Phil11111. We have added the "s/try-latest-version" label to this issue, which indicates that we'd like you to try and reproduce this issue on the latest available public version. This can happen because we think that this issue was fixed in a version that has just been released, or the information provided by you indicates that you might be working with an older version. You can install the latest version by installing the latest Visual Studio (Preview) with the .NET MAUI workload installed. If the issue still persists, please let us know with any additional details and ideally a reproduction project provided through a GitHub repository. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time. |
This issue has been moved from a ticket on Developer Community.
[regression] [worked-in:17.5.3]
I am doing an app for android using .NET MAUI. Everything was fine until I updated VisualStudio to version 17.5.4.
My app populate the screen with a bunch of collectionview to display data, the number of collectionview depend on the number of item in a list, so I have to do it dynamically in code.
Here is my code to set the collectionview and its DataTemplate. When I was using VisualStudio 17.5.3, the Label in the DataTemplate was stretching to the size of the collectionview and with its property TextAlignment set to center, the text was appearing in the center of the collectionview.
Now since 17.5.4, this exact same code doesn't stretch the label anymore, it makes it the same size of the text and the text is always on the left side of the collectionview now. the property textalignment doesn't do anything now since the label's width is the same as the text it contain. I tried to set a collectionview with a label in its datatemplate in XAML and it works fine, the label stretch to the size of the collectionview. So it looks like it is only a problem when adding the control in code dynamically.
I attached a screen shot of the result. The orange part is the collectionview's background and the label containing only the text "0" has a red background. You can see that the label doesn't stretch like it did before.
Thank you.
Original Comments
Feedback Bot on 4/12/2023, 11:04 PM:
(private comment, text removed)
Original Solutions
(no solutions)
The text was updated successfully, but these errors were encountered: