wpf - Hide a ContentControl -
Below is a good piece of artwork that represents a WPF form, in which a list box on the left and a content on the right side is
----- ----- | One | | C. | B | | ----- -------
You should create a style Use the trigger to determine the content controls, and 0 items in the list, such as:
& lt; ListBox x: name = "uiList" & gt; ... & lt; / ListBox & gt; & Lt; ContentControl & gt; & Lt; ContentControl.Content & gt; & Lt; Text box text = "There are items in the list." / & Gt; & Lt; /ContentControl.Content> & Lt; ContentControl.Style & gt; & Lt; Style TargetType = "{x: Type Content Control}" & gt; & Lt; Style.Triggers & gt; & Lt; Datatrigger binding = "{binding element name = ui list, path = item.count}" value = "0" & gt; & Lt; Setter property = "visibility" value = "collapsed" /> & Lt; / DataTrigger & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; /ContentControl.Style> & Lt; / ContentControl>