Making a grid in a ListView ItemTemplate fill

て烟熏妆下的殇ゞ 提交于 2019-12-05 04:10:50

You need to set ListViewItem.HorizontalContentAlignment to Stretch. Try adding this into your ListView definition:

<ListView.ItemContainerStyle>
    <Style TargetType="{x:Type ListViewItem}">
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
    </Style>
</ListView.ItemContainerStyle>
    <ListView Name="Husam_Copy" HorizontalAlignment="Left" Height="181" Margin="60,86,0,0" VerticalAlignment="Top" Width="189"  >
        <ListView.ItemContainerStyle>
            <Style TargetType="{x:Type ListViewItem}">
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="Padding" Value="0"/>
                <Setter Property="Margin" Value="0"/>
                <Setter Property="BorderThickness" Value="0"/>
            </Style>
        </ListView.ItemContainerStyle>
        <ListView.ItemTemplate>
            <DataTemplate>
                <Button Content="{Binding Title}" HorizontalAlignment="Stretch" Padding="0" Margin="0"  />
            </DataTemplate>
        </ListView.ItemTemplate>


    </ListView>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!