I am unable to locate开发者_如何学C a property similar to WindowsForm "DropDownWidth" Property for the Combo Box in WPF. Is there a work around to achieve this functionality?
I don't remember if there is such property in a combobox, but you always can alter a default control template. In your case you should specify a width property of a popup element in a control template. Here is a sample code, taken from one of the WPF themes from Codeplex:
<ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
...
<Popup ... Width="100" >
...
</ControlTemplate>
This is a general idea. You can look in a themes source code fore more information. This MSDN pages can also be helpful:
- Customizing the Appearance of an Existing Control by Creating a ControlTemplate
- ComboBox Styles and Templates
- Control Styles and Templates
精彩评论