WPF C# Hide TabControl Items on Application Startup

Posted by mr justinator on Stack Overflow See other posts from Stack Overflow or by mr justinator
Published on 2011-01-07T21:24:41Z Indexed on 2011/01/07 21:54 UTC
Read the original article Hit count: 266

Filed under:
|
|
|

I've created a start page that loads when the application is run but it is also showing my tabcontrol (two tabitems for editing & diagraming).

How do I hide my tabcontrol items on startup and only show it when a user selects file -> new?

Many thanks!

Xaml:

<TabControl Height="Auto" Name="tabControl1" Width="Auto">
            <TabItem Header="Diagram" Name="DiagramTab"></TabItem>
            <TabItem Header="Rulebase" Name="RuleTab" >
              <Grid>
               <TextBox Height="Auto" Name="RuleText" Width="Auto" Text="" AcceptsTab="True" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" GotFocus="FocusChanged" KeyDown="ContentChanged" HorizontalScrollBarVisibility="Visible" />
              </Grid>
           </TabItem>
        </TabControl>

Here's my file -> new menu item:

private void ProcessNewCommand()
    {
        if (dataChanged)
        {
            string sf = SaveFirst();
            if (sf != "Cancel")
            {
                ClearState();                    
            }
        }
        else
        {
            ClearState();
        }
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about wpf