I set my DataGrid to collapse when there are no items
<DataGrid Name="dataGrid"
Visibility="{Binding HasItems,
ElementName=dataGrid,
Converter={StaticResource BooleanToVisibilityConverter}}">
</DataGrid>
The problem is, I would like it to appear on design mode. How to do it? Should I create fake data?
I tried
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
if (DesignerProperties.GetIsInDesignMode(this))
{
this.dataGrid.ItemsSource = new List<Table> { new Table() };
}
}
but it didn’t work
If I understand what you are trying to do, this works well for me: