[英]WPF Settings Page; Hiding/Showing Controls; Best Practice
In WPF, I am trying to create a settings page like the one in Visual Studio (Tools -> Options) ( http://i.imgur.com/Be9cTPF.png ) 在WPF中,我试图创建一个类似Visual Studio中的设置页面(“工具”->“选项”)( http://i.imgur.com/Be9cTPF.png )
I realize the selection menu is a treeview but I am unsure how to hide/show the controls on the right. 我意识到选择菜单是树状视图,但是我不确定如何隐藏/显示右侧的控件。
What is the best and proper way of doing this in WPF? 在WPF中执行此操作的最佳和正确方法是什么?
In my opinion the best way to do this is to divide the page into 2 grid columns. 我认为最好的方法是将页面分为2个网格列。 In your first column, you can place the treeview.
在第一列中,您可以放置树视图。 The second column will consist of the data page.
第二列将包含数据页面。 You can bind the visibility of this grid column when there is a selection in the tree view using a converter or so or display a default view there.
您可以使用转换器等在树视图中进行选择时绑定此网格列的可见性,或在其中显示默认视图。
You can handle the selection changed event of the treeview and bind the selecteditem to a property and as per the selecteditem you can change the view on the second column. 您可以处理树视图的选择更改事件,并将selecteditem绑定到属性,然后根据selecteditem可以更改第二列上的视图。
Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.