This is a migrated thread and some comments may be shown as answers.

RadPane is only opened once

8 Answers 23 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Harald
Top achievements
Rank 1
Harald asked on 26 Jun 2018, 08:02 AM

In the program code, I create a Radpane and add it to a RadPaneGroup. The user can close the RadPane and open it in the RadRibbon Menu.

How can I realize that a RadPane is only opened once?


8 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 28 Jun 2018, 12:11 PM
Hello Harald,

I am not sure that I understand your requirement. May I ask you to clarify what you mean by that you open RadPane in a RadRibbon menu? And also, how many times the pane can be opened?

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Harald
Top achievements
Rank 1
answered on 28 Jun 2018, 02:28 PM
The user can open different RadPanes via the ribbon menu. I would like to deny that a RadPane can be opened twice.
0
Harald
Top achievements
Rank 1
answered on 28 Jun 2018, 02:29 PM
The user can open different RadPanes via the ribbon menu. I would like to deny that a RadPane can be opened twice.
0
Harald
Top achievements
Rank 1
answered on 28 Jun 2018, 02:31 PM
The user can open different RadPanes via the ribbon menu. I would like to deny that a RadPane of the same type can be opened twice.
0
Martin Ivanov
Telerik team
answered on 29 Jun 2018, 08:58 AM
Hello Harald,

Can you send me some code that shows how the RadPane is created and opened by the menu? And also can you tell me what ribbon menu you are using? Maybe you can include some code that shows also the menu definition.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Harald
Top achievements
Rank 1
answered on 01 Jul 2018, 07:39 PM

XAML Code:

01....
02. <telerik:RadRibbonButton x:Name="ribbonButtonCalendar" ToolTip="Tooltip" Click="ribbonButtonCalendar_Click">
03.    <StackPanel Orientation="Vertical">
04.        <Image Width="48" Height="48" Source="Images/calendar.png"/>
05.        <Label HorizontalAlignment="Center" Content="Kalender"/>
06.    </StackPanel>
07.</telerik:RadRibbonButton>
08....
09.  
10....
11.<telerik:RadDocking x:Name="DockingPanel" Grid.Row="3" BorderThickness="0">
12.    <telerik:RadDocking.DocumentHost>
13.        <telerik:RadSplitContainer SizeChanged="RadSplitContainer_SizeChanged">
14.            <telerik:RadPaneGroup>
15.                <telerik:RadDocumentPane x:Name="DocumentPane" Header="Protokoll" Visibility="Collapsed" CanUserClose="False" IsActive="True">
16.                    ...
17.                </telerik:RadDocumentPane>
18.            </telerik:RadPaneGroup>
19.        </telerik:RadSplitContainer>
20.    </telerik:RadDocking.DocumentHost>
21.    <telerik:RadSplitContainer x:Name="LeftSplitContainer" InitialPosition="DockedLeft" Width="320">
22.        <telerik:RadPaneGroup x:Name="LeftPaneGroup">                      
23.        </telerik:RadPaneGroup>
24.    </telerik:RadSplitContainer>
25.    <telerik:RadSplitContainer x:Name="RightSplitContainer" InitialPosition="DockedRight" Width="320">
26.        <telerik:RadPaneGroup x:Name="RightPaneGroup">
27.        </telerik:RadPaneGroup>
28.    </telerik:RadSplitContainer>
29.</telerik:RadDocking>
30....

 

C# Code:

01....
02.private void ribbonButtonCalendar_Click(object sender, RoutedEventArgs e)
03.    {
04.        RadPane calendar = new RadPane();
05.        calendar.Title = "Kalender";
06.        calendar.Name = "Kalender";
07.        proitdesk.Meeting.Controls.Calendar calendarControl = new Controls.Calendar();
08.        calendar.Content = calendarControl;
09.        this.RightPaneGroup.AddItem(calendar, DockPosition.Top);
10.    }
11....
0
Accepted
Martin Ivanov
Telerik team
answered on 03 Jul 2018, 07:22 AM
Hello Harald,

Thank you for the additional information.

To achieve your requirement you can check if the pane already exists in the Panes collection of the RadDocking control and add it if it is not presented there. For example:
private void ribbonButtonCalendar_Click(object sender, RoutedEventArgs e)
{
    string kalenderName = "Kalender";           
    var kalenderPane = this.DockingPanel.Panes.FirstOrDefault(x => x.Name != null && x.Name.Equals(kalenderName));
    if (kalenderPane == null)
    {
        RadPane calendar = new RadPane();
        calendar.Title = kalenderName;
        calendar.Name = kalenderName;
        this.RightPaneGroup.AddItem(calendar, DockPosition.Top);
    }
}


Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Harald
Top achievements
Rank 1
answered on 03 Jul 2018, 08:36 PM
Thanks. It works.
Tags
Docking
Asked by
Harald
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Harald
Top achievements
Rank 1
Share this question
or