Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>What you are asking to do is quite easy and possible, but I don't think you are thinking quite big enough. </p> <p>As your project grows and the number of different things that you want to show expands, then you are going to need to show and hide more and more controls. This is quite quickly going to get unmanageable. Instead think about some other controls deal with this, in some ways you are doing something very like a tabbed dialog, just with a hierarchical set of tabs.</p> <p>A tabbed dialog has a panel and a set of tabs, when you click on each tab, the content of the panel changes. In fact you can create <code>UserControl</code>s one for each specialised set of UI that you want to display, e.g. you could have a <code>ProjectControl</code> that displays all of your project textboxes, labels, buttons etc.</p> <p>In addition WPF has this neat feature called <code>DataTemplate</code>s, these define how a type of data should look when it is displayed. So if you where to have a </p> <pre><code>public class MyProject { public string Name {get;set;} } </code></pre> <p>Then you could define</p> <pre><code>&lt;DataTemplate DataType="{x:Type MyProject}&gt; &lt;TextBox Text="{Binding Name}"/&gt; &lt;/DataTemplate&gt; </code></pre> <p>And WPF will automatically convert the data into to its visual form if you set it as the content of the tab panel.</p> <p>However this type of displaying content in a panel is not the only WPF control that does this. There is also something called a <code>NavigationFrame</code>, which also can be used wrapped into a Window as a <code>NavigationWindow</code>. This control provides you ways to navigate to the next <code>Page</code> to display. <code>Page</code>s can be just like the <code>UserControl</code>s in a tabbed dialog, but can also be URIs, enabling you to link in content from the web if you wish. In addition you can call <code>NavigateTo</code> from other controls enabling you build much more usable interfaces.</p> <p>I worked through the process of building a full windows control panel style interface in </p> <ul> <li><a href="http://alski.net/post/2012/01/11/WPF-Wizards.aspx" rel="nofollow noreferrer">http://alski.net/post/2012/01/11/WPF-Wizards.aspx</a></li> <li>and <a href="http://alski.net/post/2012/01/13/WPF-Wizards-part-2-Glass.aspx" rel="nofollow noreferrer">http://alski.net/post/2012/01/13/WPF-Wizards-part-2-Glass.aspx</a> </li> </ul> <p>I've added later VS2012 style glows in </p> <ul> <li><a href="http://alski.net/post/2013/09/14/WPF-Re-creating-VS2012Office-2013-window-glow.aspx" rel="nofollow noreferrer">http://alski.net/post/2013/09/14/WPF-Re-creating-VS2012Office-2013-window-glow.aspx</a></li> </ul> <p>And then released the entire source code as open source at </p> <ul> <li><a href="http://winchrome.codeplex.com/" rel="nofollow noreferrer">http://winchrome.codeplex.com/</a></li> </ul> <p><img src="https://i.stack.imgur.com/Kx218.png" alt="WinChrome example"></p> <p>This comes with support for embedding Navigation panels with</p> <pre><code>&lt;WinChrome:SearchableNavigationWindow x:Class="WinChrome.Win7Demo.MainWindow" ... xmlns:WinChrome="clr-namespace:WinChrome;assembly=WinChrome" Style="{StaticResource Win7NavigationWindow}"&gt; &lt;WinChrome:SearchableNavigationWindow.Navigation&gt; &lt;view:Navigation x:Name="navigationTree"/&gt; &lt;/WinChrome:SearchableNavigationWindow.Navigation&gt; </code></pre> <p></p> <p><a href="http://winchrome.codeplex.com/SourceControl/latest#WinChrome.Win7Demo/MainWindow.xaml" rel="nofollow noreferrer">(Full source code)</a></p> <p>Where the navigation window is embedded as, but can also be a TreeView.</p> <pre><code>&lt;UserControl x:Class="WinChrome.View.Navigation" ...&gt; &lt;ScrollViewer HorizontalScrollBarVisibility="Disabled" Padding="12,0" VerticalScrollBarVisibility="Auto" &gt; &lt;StackPanel&gt; &lt;Button Margin="0,12,0,0" Style="{StaticResource LinkNavigatorButtonStyle}" Content="Home" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Win7Demo:MainWindow}, AncestorLevel=1}, Path=GoHomeCommand}" /&gt; &lt;/StackPanel&gt; &lt;/ScrollViewer&gt; </code></pre> <p></p> <p><a href="http://winchrome.codeplex.com/SourceControl/latest#WinChrome.Win7Demo/View/Navigation.xaml" rel="nofollow noreferrer">(Full source code)</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload