我正在尝试在ListView中水平拉伸按钮,但我的xaml代码不起作用:
<ListView Grid.Row="2" ItemsSource="{Binding Path=Items}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch">
<ListView.ItemTemplate>
<DataTemplate>
<Button Grid.Row="2" Background="White" BorderThickness="4,0,0,1" BorderBrush="#8c0095" Margin="32,-3,32,17" Padding="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">
<TextBlock Text="{Binding Name}" Foreground="#8c0095" FontSize="20" Margin="15,1,0,10" FontWeight="Medium" />
</Button>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
我该如何解决这个问题?