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

Add a new window to docking view

9 Answers 134 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Ujjwal Lahoti
Top achievements
Rank 1
Ujjwal Lahoti asked on 04 Mar 2010, 10:31 PM
I created an XAML with the Docking, this is the main view of the application. Now I want to create a new window (effect of a user action), and then I want to give user option to dock it, to the main view. I have no clue as to how to do it.

The demos that comes with the application are only good to show functionality of the product, but not good to actually use them to create your application.

9 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 05 Mar 2010, 04:37 PM
Hi Ujjwal,

 What you need to do is to create a SplitContainer, a PaneGroup and a Pane, add the pane to the group and the group to the split container. After that you should set the InitialPosition property of the SplitContainer to FloatingDockable and add it to the Docking control. This will effect in popping a new ToolWindow.

A similar thing is demonstrated in the First Look example of the Docking control, but in XAML - http://demos.telerik.com/silverlight/#Docking/FirstLook. There is an initially floating ToolWindow.

Hope this helps!

Best wishes,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ujjwal Lahoti
Top achievements
Rank 1
answered on 05 Mar 2010, 08:30 PM
Hi,

Thanks for your reply. Here are some more details on what I want to do. Your help would be appreciated here.

I am trying to create a simple application, with
1. Main docking window with no content
2. And then on 'OnLoaded' event of the window, adds 2 different panes to the docking layout.

My Main application Window XAML is (Window1.xaml):
<Window x:Class="GUIMockup_MainWindow.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:rad="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" 
    xmlns:radDock="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking" 
    Title="Window1" Height="300" Width="300" Loaded="OnLoaded"
    <Grid> 
        <rad:RadButton Visibility="Hidden"></rad:RadButton> 
        <radDock:RadDocking x:Name="radDocking1"
             
        </radDock:RadDocking> 
 
    </Grid> 
</Window> 
 

Note: RadButton was added because Telerik controls have a bug, that prevents designer to work if RadDocking is the first object in the grid or something like that. This the work around recommended by you.

I created another file with the following XAML (SystemSettings.xaml):
<radDock:RadDocking x:Class="GUIMockup_MainWindow.SystemSettings" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:radDock="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"
    <Grid> 
        <radDock:RadSplitContainer InitialPosition="FloatingDockable" 
                    radDock:RadDocking.FloatingLocation="250, 50" 
                    radDock:RadDocking.FloatingSize="300, 220"
            <radDock:RadPaneGroup> 
                <radDock:RadPane Header="Not Document Pane" CanDockInDocumentHost="False"
                    <radDock:RadPane.Content> 
                        <TextBlock TextWrapping="Wrap" 
                                    Text="This pane cannot be docked in the document host, because it has its property CanDockInDocumentHost set 'False'." /> 
                    </radDock:RadPane.Content> 
                </radDock:RadPane> 
            </radDock:RadPaneGroup> 
        </radDock:RadSplitContainer> 
    </Grid> 
</radDock:RadDocking > 
 




Class definition for this class is:
using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Data; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Imaging; 
using System.Windows.Navigation; 
using System.Windows.Shapes; 
 
namespace GUIMockup_MainWindow 
    /// <summary> 
    /// Interaction logic for SystemSettings.xaml 
    /// </summary> 
    public partial class SystemSettings : Telerik.Windows.Controls.RadDocking 
    { 
        public SystemSettings() 
        { 
            InitializeComponent(); 
        } 
    } 

In the 'Loaded' event of the Main Window I want to add System Settings, to the docking view of the Main Window.

I can't figure out how to do this. Can you help me what code would I need to do this? Also comment if there is a better way of doing this.
0
Miroslav Nedyalkov
Telerik team
answered on 10 Mar 2010, 09:47 AM
Hi Ujjwal,

As you are not concrete where exactly you want add this pane I prepared you two examples - one add the pane to the already existing pane group and the other one addst it to a new split container and a new group. You could use any of the approaches. Please find the attached example.

Just a suggestion: If you need to add a pane on the Loaded event and if you know what content it will have, why not add the pane in XAML?

If you have further questions, don't hesitate to ask.

Regards,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ujjwal Lahoti
Top achievements
Rank 1
answered on 11 Mar 2010, 07:39 AM
Thanks for your reply. However it doesn't address my problem.

To restate what I am trying to do. I am trying to create an application similar to your test application you provide. With a main Menu, and when user clicks on an menu item, a new window pops-up, which is a Floating Window. And user is free to dock it where ever they want to dock it (or just close it if they choose to do so).

In the code that I provided, I created separate XAML files. I need separate XAML files which I can create in designer, and then create those windows when user clicks on the window....this is very similar to your test application.

A good example of what I am trying to do is: http://www.codeproject.com/KB/WPF/WPFdockinglib.aspx?msg=3391615. Here the person has create his own Docking library, and adds windows when the user clicks on the menu.

Further, I don't plan to add a Pane on 'OnLoaded' event, as I stated before it will be added when the user clicks on the menu. I wrote so as not to complicate things.
0
Miroslav Nedyalkov
Telerik team
answered on 11 Mar 2010, 04:48 PM
Hello Ujjwal,

 I modified the example to meet your needs. Hope this helps.

Regards,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ujjwal Lahoti
Top achievements
Rank 1
answered on 11 Mar 2010, 05:10 PM
Thanks for your reply.

Adding a new window by pressing the button is not my problem. What I am looking for is adding another file (or class) to the project, lets say SystemSettings.xaml, and lets say the name of the class is SystemSettings. Define my new window in this XAML file. And when the user clicks "Add Floating-Only" in your example, I create an instance of the "SystemSettings" class, and add it as the floating window to the main Docking view.

What I don't know is what should be the root of this new class and how to add it to the main Docking view.
0
Miroslav Nedyalkov
Telerik team
answered on 11 Mar 2010, 08:26 PM
Hello Ujjwal,

 I'm sorry, I didn't understand your request correctly. My suggestion is to inherit from the RadPane class as you do with the UserControl class when you create a new UserControl. Please find the attached project that demonstrates this approach.

Sincerely yours,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Ujjwal Lahoti
Top achievements
Rank 1
answered on 11 Mar 2010, 09:45 PM
Thanks for the example. This is exactly what I wanted.

I have one problem, in the designer for MyPane.xaml, I can't see anything. I mean, if the Button is added, I can only see it in code, not in the designer. In the designer I only see "Pane" written. See the attached snapshot.
0
Miroslav Nedyalkov
Telerik team
answered on 12 Mar 2010, 04:50 PM
Hi Ujjwal,

Unfortunately this is the expected behavior of the RadPane control - it renders only as the header - the content is rendered in the PaneGroup. If you need to use the designer (not the XAML editor as I expected) you could create a UserControl and put it as content of the Pane.

Hope this helps!

Greetings,
Miroslav Nedyalkov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Docking
Asked by
Ujjwal Lahoti
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Ujjwal Lahoti
Top achievements
Rank 1
Share this question
or