This question is locked. New answers and comments are not allowed.
My combobox must stretch horizontally over the complete window width. This accounts for the combobox drop down button and the dropped down menu also! So I set the width of the combobox to "Auto" and bind the ItemsPanelTemplate width to the combobox width.I also use a text trimming data template for the items.
When starting the application, the width of the drop down menu is corresponding to the combobox button width and the text trimming is working, too. Resizing the window during runtime leads to the following behaviour:
1. Resizing window wider -> drop down button and drop down menu resize correctly (they stay fully stretched over the window width)
2. Resizing window smaller -> drop down button resizes correctly, drop down menu doesn't resize smaller than it was initially. So when dragging the window really small, the drop down menu is cut off.
How can I make the drop down menu width change according to the drop down menu button at runtime?
When starting the application, the width of the drop down menu is corresponding to the combobox button width and the text trimming is working, too. Resizing the window during runtime leads to the following behaviour:
1. Resizing window wider -> drop down button and drop down menu resize correctly (they stay fully stretched over the window width)
2. Resizing window smaller -> drop down button resizes correctly, drop down menu doesn't resize smaller than it was initially. So when dragging the window really small, the drop down menu is cut off.
How can I make the drop down menu width change according to the drop down menu button at runtime?
<
UserControl.Resources
>
<
DataTemplate
x:Key
=
"ComboBoxCustomTemplate"
>
<
TextBlock
Text
=
"{Binding Name}"
TextTrimming
=
"WordEllipsis"
/>
</
DataTemplate
>
<
ItemsPanelTemplate
x:Key
=
"ComboBoxItemsPanel"
>
<
VirtualizingStackPanel
Orientation
=
"Vertical"
x:Name
=
"iptCombo"
Width
=
"{Binding ActualWidth, ElementName=radComboBox, Mode=OneWay}"
HorizontalAlignment
=
"Stretch"
/>
</
ItemsPanelTemplate
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"ImageView"
Margin
=
"5"
>
<
telerik:RadComboBox
x:Name
=
"radComboBox"
HorizontalAlignment
=
"Stretch"
VerticalAlignment
=
"Top"
Width
=
"Auto"
IsEditable
=
"False"
ItemsSource
=
"{Binding Items}"
ItemsPanel
=
"{StaticResource ComboBoxItemsPanel}"
ItemTemplate
=
"{StaticResource ComboBoxCustomTemplate}"
SelectedIndex
=
"0"
>
</
telerik:RadComboBox
>
</
Grid
>