I have a comboBox that contains cars objects like the following:
<ComboBox x:Name="carsCombo" Grid.Column="1" >
<ComboBoxItem>Benz</ComboBoxItem>
<ComboBoxItem>BMW</ComboBoxItem>
<ComboBoxItem>VW</ComboBoxItem>
</ComboBox>
when the page is loaded, I don't set any selection in the code so no car is selected.. However the initial display of the comboBox will put a lable saying: "choose an item"
I want to change that string to : " choose a car" or whatever instruction i want to give the user.
I tried many properties of the comboBox but I failed.
I don't like the solution of adding and empty item and then selecting it. Because I think I can change this sentence in XAML
您可以直接在XAML中使用属性PlaceholderText。
您可以将其中一项的属性“ IsSelected”设置为true。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.