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
11 Answers, 1 is accepted
<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
{
}
}
I'm not sure I understand you correctly - do you want to customize the look of the content of the pane or the header of the pane? The pane itself is displayed as a tab item and by changing its control template you will not change the content. In the first post you are changing the content, not the header, so the two approaches you pointed are doing far different things.
Could you please explain in more details what you need to achieve and we will try to help you with this.
Your first post makes me think you are hitting an old issue we already fixes, so I would suggest you to try the latest version of Rad Controls for Silverlight.
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.
What I could suggest you is to use the ContentTemplate or the Content properties of the RadPane control. ContentTemplate seems more suitable for your requirement.
Sincerely yours,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.
<ControlTemplate x:Key="GridDgrmTemplate" TargetType="Grid">
<!-- 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/temp.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="Dwg 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="Dwg 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="Iteration:" 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="Dwg 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="Dwg 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="Dwg 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="GridDgrmStyle" TargetType="Grid">
<Setter Property="Style" Value="{StaticResource GridDgrmTemplate}"></Setter>
</Style>
----------------------------------------------------------------------------------
private void BuildNewPane(int iPaneNum)
{
RadPane rp = new RadPane();
rp.Name = "rpDgrm" + (iPaneNum - 1);
rp.CanUserPin = false;
rp.CanUserClose = true;
rp.CanFloat = false;
rp.IsPinned = true;
rp.Header = "Diagram" + (iPaneNum - 1);
try
{
Grid g = new Grid();
g.Width = 600;
g.Height = 600;
g.Style = (Style)this.Resources["GridDgrmStyle"];
g.UpdateLayout();
rp.Content = g;
rp.UpdateLayout();
rpgDiagrams.Items.Add(rp);
rpgDiagrams.UpdateLayout();
return;
}
catch
{
}
}
I'm happy that you were able to solve the problem.
Anyway I would really like to provide you with such a sample, but I cannot understand what you need to do. If you provide us with more information and with your current solution we could try to provide you another one.
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.
I was able to reproduce the described behavior - it happens for generated panes only and only when the pane that contains the searched content is not the selected one. In my opinion this problem is caused, because the content of the pane that is not currently selected is not part of the visual tree. What I would suggest you is not to put names to the user controls but to the panes to find their contents.
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.