Hide/Show RadPane in Code Behind

2 posts, 0 answers
  1. Armin
    Armin avatar
    11 posts
    Member since:
    Feb 2011

    Posted 17 Sep 2012 Link to this post

    Hi all,

    we have problems with the RadDocking Control.
    Any RadPane's in the xaml file are declared as Hidden.
    After Start my Program, you can click on the textblock control in Left Pane
    for showing 2 Top Panes. When i click on the Pane 2 showing 3 additional Panes on Bottom.
    The Program crashed when i click often on any Bottom Pane.

    Here is my code:

    XAML
    <Window x:Class="DockingTest.MainWindow"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <telerik:RadDocking Name="RadDocking" ActivePaneChanged="RadDocking_ActivePaneChanged">
                <telerik:RadDocking.DocumentHost>
                    <telerik:RadSplitContainer>
                        <telerik:RadPaneGroup Name="RadPaneGroup_Top">
                            <telerik:RadPane Header="Informationen zur Analyse" Name="RadPane_Informationen" IsHidden="True">
                                <telerik:RadPane.Content>
                                    <Grid>
                                        <TextBlock Text="Here is a Text in Pane Top #1"/>
                                    </Grid>
                                </telerik:RadPane.Content>
                            </telerik:RadPane>
                            <telerik:RadPane Header="Teilbauwerke" Name="RadPane_Teilbauwerke" IsHidden="True">
                                <telerik:RadPane.Content>
                                    <Grid>
                                        <TextBlock Text="Here is a Text in Pane Top #2"/>
                                    </Grid>
                                </telerik:RadPane.Content>
                            </telerik:RadPane>
                        </telerik:RadPaneGroup>
                    </telerik:RadSplitContainer>
                </telerik:RadDocking.DocumentHost>
                <telerik:RadSplitContainer telerik:DockingPanel.InitialSize="250,150" MaxWidth="600" InitialPosition="DockedLeft">
                    <telerik:RadPaneGroup>
                        <telerik:RadPane Header="Übersicht Analysen" CanUserClose="False">
                            <Grid>
                                <TextBlock Text="Here is a Text in Pane Left... Click to Show Top Panes." TextWrapping="Wrap" MouseDown="TextBlock_MouseDown"/>
                            </Grid>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
                <telerik:RadSplitContainer Name="RadSplitContainer_Bottom" telerik:DockingPanel.InitialSize="400, 250" InitialPosition="DockedBottom" Orientation="Horizontal" HorizontalAlignment="Stretch">
                    <telerik:RadPaneGroup HorizontalAlignment="Stretch" Name="RadPaneGroup_Bottom" >
                        <telerik:RadPane Header="Grundinformationen" Name="RadPane_Teilbauwerk_Pane1" IsHidden="True" IsSelected="True">
                            <telerik:RadPane.Content>
                                <Grid>
                                    <TextBlock Text="Here is a Text in Pane #1"/>
                                </Grid>
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                        <telerik:RadPane Header="Pane #2" x:Name="RadPane_Teilbauwerk_Pane2" IsHidden="True">
                            <telerik:RadPane.Content>
                                <Grid>
                                    <TextBlock Text="Here is a Text in Pane #2"/>
                                </Grid>
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                        <telerik:RadPane Header="Pane #3" Name="RadPane_Teilbauwerk_Pane3" IsHidden="True">
                            <telerik:RadPane.Content>
                                <Grid>
                                    <TextBlock Text="Here is a Text in Pane #3"/>
                                </Grid>
                            </telerik:RadPane.Content>
                        </telerik:RadPane>
                    </telerik:RadPaneGroup>
                </telerik:RadSplitContainer>
            </telerik:RadDocking>
        </Grid>
    </Window>

    Code behind:

    private void RadDocking_ActivePaneChanged(object sender, Telerik.Windows.Controls.Docking.ActivePangeChangedEventArgs e)
    {
        if (this.RadDocking.ActivePane.Header.ToString() == "Teilbauwerke")
        {
            this.RadPane_Teilbauwerk_Pane1.IsHidden = false;
            this.RadPane_Teilbauwerk_Pane2.IsHidden = false;
            this.RadPane_Teilbauwerk_Pane3.IsHidden = false;
     
        }
        else
        {
            this.RadPane_Teilbauwerk_Pane1.IsHidden = true;
            this.RadPane_Teilbauwerk_Pane2.IsHidden = true;
            this.RadPane_Teilbauwerk_Pane3.IsHidden = true;
        }
    }
     
    private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e)
    {
        this.RadPane_Teilbauwerk_Pane1.IsHidden = true;
        this.RadPane_Teilbauwerk_Pane2.IsHidden = true;
        this.RadPane_Teilbauwerk_Pane3.IsHidden = true;
     
        this.RadPane_Informationen.IsHidden = false;
        this.RadPane_Teilbauwerke.IsHidden = false;
     
     
        this.RadPane_Informationen.IsSelected = true;
    }

    Thanks for helping.
  2. Armin
    Armin avatar
    11 posts
    Member since:
    Feb 2011

    Posted 19 Sep 2012 Link to this post

    I have found my problem.

    thanks.
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top