I am using the PanelBar to display a two level hierarchy of menu items (Menu Sections and Menu Items). I am using a DataTemplate for the menu items and a HierarchicalDataTemplate for the root collection of menu sections. The binding is all working correctly. My problem arose when I attempted to make use of the SelectedItem Property on the PanelBar. When I bound the property to my view model (using either TwoWay or OneWayToSource) when expanding or collapsing the headers, a red border appears around the PanelBar. The animation becomes a little sluggish as well but I can live with that.
If I select one of the items the red border disappears - it will re-appear if I expand or collapse the header. If I simply remove the binding or set the binding to OneWay the red border does no appear.
With the binding set to TwoWay or OneWayToSource the view model is updated correctly. Any other binding mode results in no update of the view model.
The appearance of the red border will be unacceptable to my client and I would really appreciate any help with how I can get it so stop appearing.
Here are snippets of my XAML:
If I select one of the items the red border disappears - it will re-appear if I expand or collapse the header. If I simply remove the binding or set the binding to OneWay the red border does no appear.
With the binding set to TwoWay or OneWayToSource the view model is updated correctly. Any other binding mode results in no update of the view model.
The appearance of the red border will be unacceptable to my client and I would really appreciate any help with how I can get it so stop appearing.
Here are snippets of my XAML:
01.
<!-- Menu Item Data Template -->
02.
<
DataTemplate
DataType
=
"{x:Type entities:MenuItemModel}"
>
03.
<
StackPanel
Orientation
=
"Horizontal"
HorizontalAlignment
=
"Stretch"
>
04.
<
StackPanel.ToolTip
>
05.
<
TextBlock
Text
=
"{Binding MenuItemDescription}"
06.
HorizontalAlignment
=
"Stretch"
/>
07.
</
StackPanel.ToolTip
>
08.
<
TextBlock
Text
=
"{Binding MenuItemText}"
HorizontalAlignment
=
"Stretch"
/>
09.
</
StackPanel
>
10.
</
DataTemplate
>
11.
12.
<!-- Menu Section Data Template -->
13.
<
HierarchicalDataTemplate
DataType
=
"{x:Type entities:MenuSectionModel}"
14.
ItemsSource
=
"{Binding MenuItems}"
>
15.
<
StackPanel
Orientation
=
"Horizontal"
HorizontalAlignment
=
"Stretch"
>
16.
<
StackPanel.ToolTip
>
17.
<
TextBlock
Text
=
"{Binding MenuSectionDescription}"
18.
HorizontalAlignment
=
"Stretch"
/>
19.
</
StackPanel.ToolTip
>
20.
<
Image
Source
=
"{Binding IconData, Converter={StaticResource StrToImgConverter}}"
21.
Height
=
"32"
Width
=
"32"
/>
22.
<
TextBlock
Text
=
"{Binding MenuSectionText}"
23.
VerticalAlignment
=
"Center"
HorizontalAlignment
=
"Stretch"
24.
Margin
=
"6,0,0,0"
/>
25.
</
StackPanel
>
26.
</
HierarchicalDataTemplate
>
27.
...
28.
<
telerik:RadPane
Header
=
"{Binding ApplicationData.ApplicationName, Mode=OneWay}"
29.
CanUserClose
=
"False"
CanFloat
=
"False"
CanDockInDocumentHost
=
"False"
>
30.
<
telerik:RadPanelBar
Height
=
"Auto"
HorizontalAlignment
=
"Stretch"
31.
ExpandMode
=
"Multiple"
32.
ItemsSource
=
"{Binding ApplicationData.ApplicationMenu.MenuSections}"
33.
SelectionMode
=
"Single"
34.
SelectedItem
=
"{Binding SelectedMenuItem, Mode=OneWayToSource}"
>
35.
</
telerik:RadPanelBar
>
36.
</
telerik:RadPane
>