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

Extending Dock Controls

1 Answer 52 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Nurullah
Top achievements
Rank 1
Nurullah asked on 10 Mar 2011, 04:24 PM

Hi,

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. 

Xaml:

<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"/>
                                </StackPanel>  
                             </myDocks:myPane>
                    <myDocks:myPane Header="Pane 2" x:Name="pane2"/>
             </myDocks:myPaneGroup>
         </myDocks:mySplitContainer>
     </myDocks:myDocking>
</myDocks:myDockPanel>

CS:

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"
xmlns:telerk="http://schemas.telerik.com/2008/xaml/presentation"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
</telerk:RadPane>

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

Thanks

1 Answer, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 14 Mar 2011, 02:14 PM
Hi Nurullah,

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

<local:MyContentControl>
    <StackPanel>
        <TextBox x:Name="textBox" Text="T" />
        <Button Click="Button_Click" Content="test" />
    </StackPanel>
</local:MyContentControl>
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!


Regards,
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!
Tags
Docking
Asked by
Nurullah
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Share this question
or