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

Accessing Content Control of a userControl as a radPanel Bar

3 Answers 98 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Pranama Moorthy
Top achievements
Rank 1
Pranama Moorthy asked on 25 Oct 2010, 12:17 PM
Hi Telerik Team,

I have my RadPanelBar set up as below

<

 

UserControl.Resources>

 

 

 

<core:HierarchicalDataTemplate x:Name="fieldCollectionTemplate" ItemsSource="{Binding fieldCollection}">

 

 

 

<StackPanel Orientation="Vertical" x:Name="stackPanelForControls">

 

 

 

<local:SearchFieldControl/>

 

 

 

</StackPanel>

 

 

 

</core:HierarchicalDataTemplate >

 

 

 

</UserControl.Resources>

 

 

 

<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource SampleFile}}">

 

 

 

<Grid.RowDefinitions>

 

 

 

<RowDefinition Height="*"/>

 

 

 

<RowDefinition Height="Auto"/>

 

 

 

</Grid.RowDefinitions>

 

 

 

<telerikNavigation:RadPanelBar HorizontalAlignment="Left" Margin="8,64,0,32" VerticalAlignment="Stretch" Width="240"

 

 

ItemsSource="{Binding FieldGroupCollection}" x:Name="searchPanel" Grid.Row="0" IsTextSearchEnabled="True">

 

 

 

<telerikNavigation:RadPanelBar.ItemTemplate>

 

 

 

<core:HierarchicalDataTemplate ItemsSource="{Binding fieldCollection}"

 

 

ItemTemplate="{StaticResource fieldCollectionTemplate}">

 

 

 

<TextBlock Text="{Binding Name}" Foreground="Blue" />

 

 

 

</core:HierarchicalDataTemplate>

 

 

 

</telerikNavigation:RadPanelBar.ItemTemplate>

 

 

 

</telerikNavigation:RadPanelBar>

 

 

 

<!--<Button x:Name="btnLoad" Grid.Row="1" Height="50" Width="80" HorizontalAlignment="Left" Content="Load Data"/>-->

 

 

 

<core:RadButton HorizontalAlignment="Left" Margin="48,0,0,6" VerticalAlignment="Bottom" Content="RadButton" x:Name="btnLoad" Click="btnLoad_Click" />

 

 

 

</Grid>

 

</

 

UserControl>

I have Created a Search userControl which has a text Box and a ContentControl inside it.

I need to dynamically go and set the ContentControl in the Search User Control to a Combo Box, Date or checkbox , on a click of a button, but given the template I have, I am not sure, How I can Iterate through the RadPanel Bar to set the contentControl within the UserControl which is a part of the heirarchical DataTemplate. Please advice.

 

3 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 28 Oct 2010, 01:06 PM
Hello Pranama Moorthy,

Please accept my apology for the delayed response. I prepared a sample project for you  in which you can dynamically set the Content of the ContentControl  by pressing different buttons. Please examine it and let me know if it satisfies your needs.

Feel free to ask if you need more assistance. We would be glad to help you.

Best wishes,
Petar Mladenov
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
0
Pranama Moorthy
Top achievements
Rank 1
answered on 29 Oct 2010, 06:59 AM
Hi Petar,

I actually dont want to do the action, using a load button, I should want to do it.. when the Item Container is filled up. But the problem is ItemContainer, is virtualized i think, hence it doesnt find its child elements if each of the radpanelBarItem is not in an expanded state.. Could you just show, How I could do it in such a way that it loads automatically the content of the Content Control in the Usercontrol?

0
Petar Mladenov
Telerik team
answered on 03 Nov 2010, 05:10 PM
Hello Pranama Moorthy,

You can implement your logic by handling the ContentControl.Loaded event like in the code snippet below:
private void contentControl_Loaded(object sender, RoutedEventArgs e)
        {
            (sender as ContentControl).Content = GetComboBox();
        }

Please give it a try and let me know if this is what you had in mind. If it`s not, please elaborate more on your scenario and we would be glad to assist you further.

Regards,
Petar Mladenov
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
PanelBar
Asked by
Pranama Moorthy
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Pranama Moorthy
Top achievements
Rank 1
Share this question
or