Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In the WPF demo application <a href="http://www.vertigo.com/familyshow.aspx" rel="nofollow">Family Show</a>, user controls are created in the main window (<a href="http://familyshow.codeplex.com/SourceControl/changeset/view/51712#917341" rel="nofollow">MainWindow.xaml</a>)</p> <pre><code>&lt;!-- New User Control --&gt; &lt;local:NewUserControl x:Name="NewUserControl" HorizontalAlignment="Center" VerticalAlignment="Center" AddButtonClick="NewUserControl_AddButtonClick"/&gt; </code></pre> <p>Then in the code behind (<a href="http://familyshow.codeplex.com/SourceControl/changeset/view/51712#917340" rel="nofollow">MainWindow.xaml.cs</a>), the different user controls are hidden or shown as a result of click actions from the button.</p> <pre><code>/// &lt;summary&gt; /// Hides the New User Control. /// &lt;/summary&gt; private void HideNewUserControl() { NewUserControl.Visibility = Visibility.Hidden; DiagramControl.Visibility = Visibility.Visible; enableButtons(); if (family.Current != null) DetailsControl.DataContext = family.Current; } /// &lt;summary&gt; /// Shows the New User Control. /// &lt;/summary&gt; private void ShowNewUserControl() { HideFamilyDataControl(); HideDetailsPane(); DiagramControl.Visibility = Visibility.Collapsed; WelcomeUserControl.Visibility = Visibility.Collapsed; if (PersonInfoControl.Visibility == Visibility.Visible) ((Storyboard)this.Resources["HidePersonInfo"]).Begin(this); NewUserControl.Visibility = Visibility.Visible; NewUserControl.ClearInputFields(); NewUserControl.SetDefaultFocus(); ... //Removed for brevity } </code></pre> <p>I encourage you to download the Family Show app to look at the source code, or to <a href="http://familyshow.codeplex.com/SourceControl/changeset/view/51712" rel="nofollow">browse</a> it at least on-line. </p> <p>You could put it in a separate window like Johannes Hofmeister suggested with his answer. </p> <p>The main advantage of a User Control is that this user interface block might be used at multiple points in an application. (eg. a graph control user control with scroll, zoom and screenshot buttons would appear next to every graph, making it an ideal candidate for a user control).</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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