Dependency Injection in Docking Manager

2 posts, 0 answers
  1. Seth
    Seth avatar
    3 posts
    Member since:
    May 2012

    Posted 21 May 2012 Link to this post

    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:RadDocumentPane>Stuff here</telerik:RadDocumentPane>

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

    kernel =
    new StandardKernel(new AppModule());

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

    <UserControl x:Class="Whiteboard.Plugin.UI.UnclassLegend"<br>
                 xmlns:mc="" <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?
  2. Miroslav Nedyalkov
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 29 May 2012 Link to this post

    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 >>

  3. DevCraft R3 2016 release webinar banner
Back to Top