Default value for comboBox

◇◆丶佛笑我妖孽 提交于 2019-12-01 01:57:06

You do not need to create your own empty string, string has a static field for that, so you could set it in the style like this:

Value="{x:Static System:String.Empty}"

And why don't you just use a normal setter in your style right away?

<Style x:Key="statusComboStyle" TargetType="{x:Type ComboBox}">
    <Setter Property="SelectedIndex" Value="0"/>
</Style>

(You should make sure that there is at least one item in the ComboBox)

Binding="{Binding Path=Name.Length, FallbackValue=0, TargetNullValue=0}" Value="0">
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!