In my RadPane I have a Listbox that is part of a UserControl in the Content section that I need to bind to a ComboBox in the TitleTemplate section; is this possible? A co-worker suggested searching the visual tree but I'm hoping there's a better way. The code currently falls down on the ItemsSource binding in the UserControl. A XAML solution is preferred but code-behind is fine if that is what is required.
TitleTemplate:
UserControl:
Code for customized RadPane:
TitleTemplate:
<
DataTemplate
x:Key
=
"TitleTemplate"
>
<
Grid
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
ContentPresenter
Content
=
"{Binding}"
/>
<
StackPanel
Orientation
=
"Horizontal"
Grid.Column
=
"1"
>
<
ComboBox
x:Name
=
"Top"
ItemsSource
=
"{Binding Source={x:Static TopLevelElements}}"
/>
<
ComboBox
x:Name
=
"Middle"
ItemsSource
=
"{Binding ElementName=Top, Path=SelectedItem.MiddleLevelElements}"
/>
</
StackPanel
>
</
Grid
>
</
DataTemplate
>
UserControl:
<!--xmlns declarations in example omitted for brevity-->
<
UserControl
x:Class
=
"BottomItemView"
>
<
Border
>
<
ListBox
x:Name
=
"Bottom"
ItemsSource
=
"{Binding ElementName=Middle, Path=SelectedItem.BottomLevelElements}"
/>
</
Border
>
</
UserControl
>
Code for customized RadPane:
Public
Class
CustomRadPane
Inherits
RadPane
Public
Sub
New
(
ByVal
title
As
Object
)
MyBase
.
New
()
Me
.Title = title
Me
.TitleTemplate = TryCast(FindResource(
"TitleTemplate"
), DataTemplate)
Me
.Content = System.Activator.CreateInstance(BottomItemView)
End
Sub
End
Class