Hello,
I'm trying to dynamically update the MaxHeight property of a RadMenuItem based upon the value in another property (binding to a frameworkelement ActualHeight). The binding appears to work great when I first click on each RadMenuItem, upon subsequent clicking of each Item the binding is no longer respected. Binding code below...
The property getter for DropDownMenuMaxSize is called upon first click of each menu item but never called again. The Setter is called when I expect it to, but in turn the breakpoint on the getter for DropDownMenuMaxSize is never called again. I've tried putting a dummy converter on the style binding, but that is only called once as well. Any suggestions?
I'm trying to dynamically update the MaxHeight property of a RadMenuItem based upon the value in another property (binding to a frameworkelement ActualHeight). The binding appears to work great when I first click on each RadMenuItem, upon subsequent clicking of each Item the binding is no longer respected. Binding code below...
The property getter for DropDownMenuMaxSize is called upon first click of each menu item but never called again. The Setter is called when I expect it to, but in turn the breakpoint on the getter for DropDownMenuMaxSize is never called again. I've tried putting a dummy converter on the style binding, but that is only called once as well. Any suggestions?
<
Style
x:Key
=
"RadMenuItemStyle"
TargetType
=
"telerik:RadMenuItem"
>
<
Setter
Property
=
"Padding"
Value
=
"0"
/>
<
Setter
Property
=
"Margin"
Value
=
"0"
/>
<
Setter
Property
=
"VerticalAlignment"
Value
=
"Center"
/>
<
Setter
Property
=
"ItemsPanel"
>
<
Setter
Property
=
"ItemsPanel"
>
<
Setter.Value
>
<
ItemsPanelTemplate
>
<
telerik:RadWrapPanel
Orientation
=
"Vertical"
MaxHeight
=
"{Binding ElementName=xThisWindow, Path=DropDownMenuMaxSize}"
/>
</
ItemsPanelTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
<
telerik:ContainerBindingCollection
x:Key
=
"RadMenuDataItemBinding"
>
<
telerik:ContainerBinding
PropertyName
=
"IsChecked"
Binding
=
"{Binding IsChecked, Mode=TwoWay}"
/>
<
telerik:ContainerBinding
PropertyName
=
"IsEnabled"
Binding
=
"{Binding IsEnabled, Mode=TwoWay}"
/>
<
telerik:ContainerBinding
PropertyName
=
"IsCheckable"
Binding
=
"{Binding IsCheckable}"
/>
<
telerik:ContainerBinding
PropertyName
=
"IsSeparator"
Binding
=
"{Binding IsSeparator}"
/>
<
telerik:ContainerBinding
PropertyName
=
"StaysOpenOnClick"
Binding
=
"{Binding StaysOpenOnClick}"
/>
</
telerik:ContainerBindingCollection
>
<
telerik:RadMenu
x:Name
=
"xRadMenuTools"
Width
=
"Auto"
Margin
=
"4,3,0,3"
Height
=
"22"
ClickToOpen
=
"True"
ItemClick
=
"RadMenu_ItemClick"
HorizontalAlignment
=
"Left"
ItemContainerStyle
=
"{StaticResource RadMenuItemStyle}"
>
<
telerik:RadMenuItem
x:Name
=
"xRadMenuItem1"
Header
=
"Tools"
>
<
telerik:RadMenuItem.ItemTemplate
>
<
telerik:HierarchicalDataTemplate
telerik:ContainerBinding.ContainerBindings
=
"{StaticResource RadMenuDataItemBinding}"
>
<
TextBlock
Text
=
"{Binding DisplayName}"
controlsToolTip:ToolTipService.ToolTip
=
"{Binding ToolTip}"
/>
</
telerik:HierarchicalDataTemplate
>
</
telerik:RadMenuItem.ItemTemplate
>
</
telerik:RadMenuItem
>
..more menu items....
</
telerik:RadMenu>