I have a datagrid that binds its data from SelectedItem of a TreeView.
The problem is how to auto hide the grid container using DataTrigger if the datagrid has no items ?
<Grid Name="grid1" Visibility="Visible">
<DataGrid Name="datagrid1" ItemsSource="{Binding ElementName=treeview1, Path=SelectedItem}"/>
</Grid>
I think this link may be helpful.
Check the data source in the code behind, during a page load event. If the data source is empty (according to your criteria), then set datagrid1.visible = false. For completeness sake, set it to true if you do find some data worth displaying.