WPF Editable ComboBox HorizontalContentAlignment在ItemsControl问题中 [英] WPF Editable ComboBox HorizontalContentAlignment in ItemsControl problem
问题描述
我在ItemsControl中有一个具有iseditable属性为true的组合框.
我将组合框HorizontalContentAlignment设置为右".
下拉值显示在右侧.
但是选择之后,在左侧显示的值.
<
x :
b ;
="150"
;
="340"
b ;
=" Stretch"
b ;
=&; { 绑定 路径 = Alignment}"
b ;
=" True"
b ;
=" DisplayValue"
b ;
=" Field_GotFocus"
b ;
=&; { 绑定 AreCorrectionFieldsEnabled }"
b ;
=" True"
b ;
=" Field_IsVisibleChanged"
b ;
=&; { 绑定 路径 = CustomFieldValues}"
b ;
=键"
b ;
=&; { DynamicResource SmallNormalTextStyle }"
b ;
="32";>
请在这里帮助我.
我认为必须使用其他样式.
如果将样式设置为x:null而不是那里的样式,它是否正确对齐?
我的实验性标记均采用硬编码:
< StackPanel> < ComboBox IsEditable ="True" HorizontalContentAlignment =右" VerticalAlignment =顶部"宽度="200". 样式="{x:Null}" > < ComboBoxItem Content =无"/> < ComboBoxItem Content =很少"/> < ComboBoxItem Content ="Some"/> < ComboBoxItem Content =足够"/> < ComboBoxItem Content =很多"; /> < ComboBoxItem Content =太多"; /> </ComboBox> <按钮内容=关注焦点"/> </StackPanel>
键入的文本或选定的项目失去焦点后将保持右对齐.
I have a combobox with iseditable property to true inside ItemsControl.
I set my combobox HorizontalContentAlignment to "Right".
The dropdown values are showing in right side.
But after selection the values shown in left side.
<
ComboBoxx:Name="comboBoxCustomReadOnly"
MinWidth="150"
MaxWidth="340"
HorizontalAlignment="Stretch"
FlowDirection="{BindingPath=Alignment}"
AllowDrop="True"
DisplayMemberPath="DisplayValue"
GotFocus="Field_GotFocus"
IsEnabled="{BindingAreCorrectionFieldsEnabled}"
IsReadOnly="True"
IsVisibleChanged="Field_IsVisibleChanged"
ItemsSource="{BindingPath=CustomFieldValues}"
SelectedValuePath="Key"
Style="{DynamicResourceSmallNormalTextStyle}"
TabIndex="32">
Please help me here.
I think another style must be doing that.
If you set style to x:null instead of what you have there, does it align right?
My experimental markup is all hard coded:
<StackPanel> <ComboBox IsEditable="True" HorizontalContentAlignment="Right" VerticalAlignment="Top" Width="200" Style="{x:Null}" > <ComboBoxItem Content="None"/> <ComboBoxItem Content="Few"/> <ComboBoxItem Content="Some"/> <ComboBoxItem Content="Enough"/> <ComboBoxItem Content="Lots" /> <ComboBoxItem Content="Too much" /> </ComboBox> <Button Content="Take Focus"/> </StackPanel>Typed text or selected items remain right aligned once it loses focus.
这篇关于WPF Editable ComboBox HorizontalContentAlignment在ItemsControl问题中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!