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

Error adding controls to new RadPane

2 Answers 61 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Lindsay Miles
Top achievements
Rank 1
Lindsay Miles asked on 06 May 2010, 01:25 PM

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 Answers, 1 is accepted

Sort by
0
Lindsay Miles
Top achievements
Rank 1
answered on 06 May 2010, 04:31 PM
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

            {

            }

}



0
Miroslav Nedyalkov
Telerik team
answered on 11 May 2010, 09:59 AM
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.
Tags
Docking
Asked by
Lindsay Miles
Top achievements
Rank 1
Answers by
Lindsay Miles
Top achievements
Rank 1
Miroslav Nedyalkov
Telerik team
Share this question
or