У меня есть сетка только с 1 столбцом, и я хочу, чтобы моя кнопка соответствовала размеру сетки, я пытался использовать StackLayout, и Frame, теперь я пытаюсь с сеткой, также пытался с 1 столбцом и с 1 строкой,но результат тот же, я приложу фото, чтобы показать, что происходит:
Мне нужны красные кнопки, чтобы растянуть, чтобы они заполнилиширину устройства, я пробовал со свойствами StartAndExpand, Fill и FillAndExpand в горизонтальных опциях, но они не работают. с помощью Fill и FillAndExpand это работает, но текст кнопки перемещается в центр, а затем возникает ошибка, при которой каждый раз, когда я нажимаю на строку, текст перемещается влево и остается там, пока я не прокручиваю представление списка вниз и снова не возвращаю верхнюю часть.
Вот мой код:
<ListView x:Name="GroupsList"
ItemsSource="{Binding Dishes}"
IsGroupingEnabled="True"
SeparatorColor="Black"
SeparatorVisibility="Default"
HasUnevenRows="True">
<ListView.Behaviors>
<behaviorsPack:SelectedItemBehavior Command="{Binding BindingContext.SelectedDishCommand, Source={x:Reference DishesPage}}"></behaviorsPack:SelectedItemBehavior>
</ListView.Behaviors>
<ListView.GroupHeaderTemplate>
<DataTemplate>
<ViewCell Height="50">
<Grid VerticalOptions="FillAndExpand"
BackgroundColor="LightSlateGray">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button BackgroundColor="DarkRed"
Grid.Column="0"
BorderColor="Transparent"
BorderWidth="0"
Text="{Binding Key}"
TextColor="White"
HorizontalOptions="StartAndExpand"
Command="{Binding BindingContext.SelectGroupHeader, Source={x:Reference DishesPage}}"
CommandParameter="{Binding Key}"
ImageSource="next_disclosure"
ContentLayout="Right"></Button>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.GroupHeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ContentView Padding="2, 5, 5, 0">
<Frame Padding="2"
HasShadow="False"
BackgroundColor="White">
<StackLayout Orientation="Horizontal">
<Label Margin="10"
Text="{Binding Name}"
TextColor="Black"
FontSize="Medium"
HorizontalOptions="StartAndExpand"></Label>
</StackLayout>
</Frame>
</ContentView>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Надеюсь, кто-нибудь может мне помочь, пожалуйста.