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

Dependency Injection in Docking Manager

1 Answer 157 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Seth
Top achievements
Rank 1
Seth asked on 22 May 2012, 02:28 AM
How do I inject a RadSplitContainer to my main docking manager (telerik:RadDocking). Currently I'm doing the following.

I am using the ninject DI framework.

I have the following code in my main main window.

<telerik:RadDocking x:Name="mainDockingManager" Grid.Row="1" Grid.Column="0">
<telerik:RadDocking.DocumentHost>
<telerik:RadSplitContainer><telerik:RadPaneGroup>
<telerik:RadDocumentPane>Stuff here</telerik:RadDocumentPane>
</telerik:RadPaneGroup>
</telerik:RadSplitContainer>
</telerik:RadDocking.DocumentHost><br></telerik:RadDocking>

In the constructor I initialise the DI framework and inject the ILegend usercontrol into the docking manager.

 
InitializeComponent();
kernel =
new StandardKernel(new AppModule());
this.mainDockingManager.Items.Add(kernel.Get<ILegend>());


The ILegend UserControl is just a wrapper around a <telerik:RadSplitContainer> i.e.:

<UserControl x:Class="Whiteboard.Plugin.UI.UnclassLegend"<br>
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"<br>
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"<br>
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" <br>
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"<br>
             xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Docking"<br>
             mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300"><br>
    <telerik:RadSplitContainer telerik:DockingPanel.InitialSize="170,500" InitialPosition="DockedLeft">


This method doesn't seem to be working, is it possible to inject different implementations of a RadSplitContainer containing different content?

1 Answer, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 29 May 2012, 04:31 PM
Hi Seth,

The problem is that you are wrapping the RadSplitContainer inside a UserControl and the Docking control expects to receive a RadSplitContainer directly. What I would suggest you is to use the SplitContainer as root element of the XAML file instead of the UserControl to change the code-behind file to make your class to inherit from RadSplitContainer instead of UserControl. Similar approach is described in this article about the RadWindow control.

Hope this information is helpful.

Kind regards,
Miroslav Nedyalkov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Docking
Asked by
Seth
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Share this question
or