none
gridview如何隐藏表头?也就是如何隐藏gridviewcolumn以及所显示的信息。 RRS feed

答案


  • Hi 轮回的齿轮,

    你可以尝试下面的代码来藏gridviewcolumn以及所显示的信息。

       
    <ListView>
            <ListView.Resources>
                <ResourceDictionary>
                    <Style x:Key="hiddenStyle" TargetType="GridViewColumnHeader">
                        <Setter Property="Visibility" Value="Hidden"/>
                    </Style>
                </ResourceDictionary>
            </ListView.Resources>
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="First Name" 
                          DisplayMemberBinding="{Binding XPath=FirstName}" />
                    <GridViewColumn Header="Last Name" 
                          DisplayMemberBinding="{Binding XPath=LastName}" HeaderContainerStyle="{StaticResource hiddenStyle}"/>
                    <GridViewColumn Header="Favorite City"
                          DisplayMemberBinding="{Binding XPath=FavoriteCity}"/>
                </GridView>
            </ListView.View>
        </ListView>

    Best Regards,

    Yohann Lu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2016年11月14日 8:18
    版主