Extending Dock Controls

2 posts, 0 answers
  1. Nurullah
    Nurullah avatar
    6 posts
    Member since:
    Dec 2009

    Posted 10 Mar 2011 Link to this post


    I'm trying to extend Docking Controls in Telerik. However, before adding new features, just changing namespaces causes exceptions.

    As an example, although i can get events of child components in RadPane, I cannot access them without casting. 


    <myDocks:myDockPanel Width="350" Height="280" x:Name="panel" Loaded="panel_Loaded" >
         <myDocks:myDocking x:Name="docking" Width="345" Height="275" Loaded="docking_Loaded" >
               <myDocks:mySplitContainer Width="250" Height="250" x:Name="split" Loaded="split_Loaded" >
                      <myDocks:myPaneGroup x:Name="paneGroup" Width="245" Height="235" Loaded="paneGroup_Loaded" >
                               <myDocks:myPane Header="Pane 1" x:Name="pane1" Loaded="pane1_Loaded">
                                   <StackPanel x:Name="stack">
                                                <TextBlock x:Name="txtRandomNumber" FontSize="36" Text="SetNumber" HorizontalAlignment="Center" Margin="5"/>
                                                 <Button x:Name="btnRandomGenerator" Width="100" Height="35" Content="Random" Click="btnRandomGenerator_Click"/>
                        <myDocks:myPane Header="Pane 2" x:Name="pane2"/>


    private void btnRandomGeneratorR_Click(object sender, RoutedEventArgs e)
            Random r = new Random();
            txtRandomNumber.Text = r.Next(1, 9999).ToString(); /////this line throws exception that says txtRandomNumber is null 


    And my controls are extended similar to below:

    <telerk:RadPane x:Class="myControls.myDocking.myPane"
    d:DesignHeight="300" d:DesignWidth="400">

    What should I add or change for my extented controls to access their contents ?


  2. Miroslav Nedyalkov
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 14 Mar 2011 Link to this post

    Hi Nurullah,

     This is not supported by Silverlight. It doesn't work with ContentControl as well. You could refer to the following example:

            <TextBox x:Name="textBox" Text="T" />
            <Button Click="Button_Click" Content="test" />
    The TextBox with name textBox cannot be resolved from the code behind. MyContentControl inherits from ContentControl in XAML like you do with the RadPane.

    If you have further questions don't hesitate to ask!

    Miroslav Nedyalkov
    the Telerik team
    Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Back to Top