Error adding controls to new RadPane

3 posts, 0 answers
  1. Lindsay Miles
    Lindsay Miles avatar
    75 posts
    Member since:
    Dec 2009

    Posted 06 May 2010 Link to this post

    Hello,

    I have a RadSplitContainer rsc containing RadPaneGroup rpg containing RadPane rp1.

    rp1 contains nested StackPanels which contain various controls - labels, txtboxes etc.

    That is all in xaml and all works/displays, no problem.

    However, in code, I do something like this (add new RadPane with controls):

    Label lbl = new Label();

    lbl.Name = "lbl1";

    lbl.Content = "Some Label";

    StackPanel sp = new StackPanel();

    sp.Children.Add(lbl);

    Grid grd = new Grid();

    grd.Children.Add(sp);

    RadPane rp2 = new RadPane();

    rp2.Content = grd;

    then I add the rp2 to the RadPaneGroup rpg

    rpg.Items.Add(rp2)

    The panel is displayed in the right place, right order etc etc.

    PROBLEM:

    My label control is visible on rp1 NOT rp2 but I added it to rp2.Content

    The controls (in my full version) are ending up in the wrong RadPane (rp1) and NOT in the pane I am adding them to (rp2) in code!

    What might I be doing wrong?

    Anyone?

    Thanks

  2. Lindsay Miles
    Lindsay Miles avatar
    75 posts
    Member since:
    Dec 2009

    Posted 06 May 2010 Link to this post

    New Approach.

    Built a Template, assigned it to a Style then tried adding a new RadDocumentPane with the Style to the RadPaneGroup.

    No controls show in the panes. The panes display as needed, ie: docked and tabbed at the top.
    But as one clicks each pane (see I add 3 or 4), none of the panes show any of the controls from the Template/Style.

    Code and markup below with the xaml and method to add a pane.
    I've tried using a RadPane and a RadDocumentPane to no avail.
    If the Grid is commented IN or OUT, no difference.
    Combobox items removed for clarity

    ANY HELP PLEASE!!!

            <ControlTemplate x:Key="RadPaneTemplate" TargetType="telerikDocking:RadDocumentPane">

                

                <!--Grid Width="600" Height="600" Background="Cyan" -->

                    <StackPanel Width="600" Height="600" Orientation="Vertical">

                        <Canvas Height="300" Width="600" MouseLeftButtonDown="canvas1_MouseLeftButtonDown" MouseLeftButtonUp="canvas1_MouseLeftButtonUp" MouseMove="canvas1_MouseMove" Margin="0,0,0,0">

                            <Image Margin="0,0,0,0" Source="/MyApp;component/Images/pngs/test.png"></Image>

                        </Canvas>

                        <Canvas Height="300" Width="600">

                            <StackPanel Height="300" Width="600" Orientation="Vertical" >

                                <StackPanel Height="25" Width="597" Orientation="Horizontal" Margin="4,0,0,0" HorizontalAlignment="Left">

                                    <StackPanel Orientation="Horizontal" Width="175" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="0,3,0,0">

                                        <dataInput:Label Content="Dgrm Type:" Height="25" Width="70"></dataInput:Label>

                                        <ComboBox Width="100"></ComboBox>

                                    </StackPanel>

                                    <StackPanel Orientation="Horizontal" Width="220" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="0,3,0,0">

                                        <dataInput:Label Content="Dgrm Focus:" Height="25" Width="70"></dataInput:Label>

                                        <ComboBox Width="138"></ComboBox>

                                    </StackPanel>

                                    <StackPanel Orientation="Horizontal" Width="200" HorizontalAlignment="Left" VerticalAlignment="Stretch" Margin="0,3,0,0">

                                        <dataInput:Label Content="Sequence:" Height="25" Width="115" ></dataInput:Label>

                                        <ComboBox Width="85"></ComboBox>

                                    </StackPanel>

                                </StackPanel>

                                <StackPanel Height="25" Width="370" Orientation="Horizontal" Margin="4,3,0,0" HorizontalAlignment="Left">

                                    <dataInput:Label Content="Dgrm Title:" Height="25" Width="70" HorizontalAlignment="Left"></dataInput:Label>

                                    <TextBox Width="295" HorizontalAlignment="Left"></TextBox>

                                </StackPanel>

                                <StackPanel Orientation="Horizontal" Width="600" Height="240">

                                    <StackPanel Height="235" Width="297" Orientation="Vertical">

                                        <dataInput:Label Content="Dgrm Notes:" Height="25" Margin="4,0,0,0"></dataInput:Label>

                                        <TextBox Height="200" Margin="4,0,0,0" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"></TextBox>

                                    </StackPanel>

                                    <StackPanel Height="235" Width="297" Orientation="Vertical">

                                        <dataInput:Label Content="Dgrm Description:" Height="25" Margin="4,0,0,0"></dataInput:Label>

                                        <TextBox Height="200" Margin="4,0,0,0" AcceptsReturn="True" VerticalScrollBarVisibility="Auto"></TextBox>

                                    </StackPanel>

                                </StackPanel>

                            </StackPanel>

                        </Canvas>

                    </StackPanel>

                <!-- /Grid -->

            </ControlTemplate>

            <Style x:Key="RadPaneStyle" TargetType="telerikDocking:RadDocumentPane">

                <Setter Property="Template" Value="{StaticResource RadPaneTemplate}"></Setter>

            </Style>

            private void BuildNewPane(int iPaneNum)

            {

    //iPaneNum is the current pane count on the RadPaneGroup

                RadDocumentPane rp = new RadDocumentPane();

                //rp.Name = "rpDgrm" + (iPaneNum - 1);

                rp.CanUserPin = false;

                rp.CanUserClose = false;

                rp.CanFloat = false;

                rp.IsPinned = true;

                rp.Header = "Diagram" + (iPaneNum - 1);

                try

                {

                    //rp.Template = (ControlTemplate)this.Resources["RadPaneTemplate"];

                    rp.Style = (Style)this.Resources["RadPaneStyle"];

                    rp.UpdateLayout();

                    rpgDiagrams.Items.Add(rp);

                    rpgDiagrams.UpdateLayout();

                }

                catch

                {

                }

    }



  3. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 11 May 2010 Link to this post

    Hi Lindsay,

     I answered on the other thread you posted: http://www.telerik.com/community/forums/silverlight/docking/307159-error-adding-controls-to-new-radpane.aspx.

    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.
Back to Top