我正在使用DataGrid控件,我需要隐藏它。我试过使用dtgAllAccounts.Visibility = Visibility.Collapsed。但这不起作用。列标题仍然可见。有没有办法隐藏整个DataGrid与所有列标题?
<sdk:DataGrid AutoGenerateColumns="False" HorizontalAlignment="Center" Name="dtgAllAccounts" VerticalAlignment="Center" SelectionMode="Single">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn Binding="{Binding FriendlyName}" Header="Friendly Name" IsReadOnly="True"></sdk:DataGridTextColumn>
<sdk:DataGridTextColumn Binding="{Binding Email}" Header="Email" IsReadOnly="True"></sdk:DataGridTextColumn>
</sdk:DataGrid.Columns>
</sdk:DataGrid>
答案 0 :(得分:3)
将其包裹在Grid
中并隐藏它。