This question is locked. New answers and comments are not allowed.
I am having an issue getting the value of the selected subitems in a panel bar.
There is a main heading "by State" and the subitems are a list of states, TX, CA, NC, NY etc..
I have this code from another example:
It will spit out "Silverlight.Application.DataItem", but i see no way to get to the actual value.(need to know which stat they selected)
Even the code that is commented out(which one user said fixed this problem) does not work.
Can some shed some light on how to get the actual value of the selected item?
the Xaml is:
<UserControl x:Class="SilverlightApplication2.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<UserControl.Resources>
<telerik:HierarchicalDataTemplate x:Key="DataItemTemplate" ItemsSource="{Binding Items}">
<StackPanel>
<TextBlock Text="{Binding Text}" />
<TextBlock Text="{Binding Text}" />
</StackPanel>
</telerik:HierarchicalDataTemplate>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<telerik:RadPanelBar x:Name="panelBar1" ItemTemplate="{StaticResource DataItemTemplate}"
Selected="panelBar1_Selected" />
</Grid>
</UserControl>
There is a main heading "by State" and the subitems are a list of states, TX, CA, NC, NY etc..
I have this code from another example:
1.
1.
private
void
panelBar1_Selected(
object
sender, Telerik.Windows.RadRoutedEventArgs e)RadPanelBarItem container = e.Source
as
RadPanelBarItem;
var textBlocksCollection = container.ChildrenOfType<TextBlock>();
var testmessage = container.ToString();
MessageBox.Show(testmessage);
// RadPanelBarItem pbBarItem = e.Source as RadPanelBarItem;
//TextBlock Name = pbBarItem.ChildrenOfType<TextBlock>();
//MessageBox.Show(Name.Text);
MessageBox.Show(textBlocksCollection.Count().ToString() + " text blocks found");<br> }
It will spit out "Silverlight.Application.DataItem", but i see no way to get to the actual value.(need to know which stat they selected)
Even the code that is commented out(which one user said fixed this problem) does not work.
Can some shed some light on how to get the actual value of the selected item?
the Xaml is:
<UserControl x:Class="SilverlightApplication2.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
<UserControl.Resources>
<telerik:HierarchicalDataTemplate x:Key="DataItemTemplate" ItemsSource="{Binding Items}">
<StackPanel>
<TextBlock Text="{Binding Text}" />
<TextBlock Text="{Binding Text}" />
</StackPanel>
</telerik:HierarchicalDataTemplate>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White">
<telerik:RadPanelBar x:Name="panelBar1" ItemTemplate="{StaticResource DataItemTemplate}"
Selected="panelBar1_Selected" />
</Grid>
</UserControl>