<Grid Grid.Row="5" Grid.Column="1">
<ComboBox Cursor="Hand" SelectedItem="{Binding SelectedRealEstate}" Background="White"
Name="cbbRealEstates" ItemsSource="{Binding RealEstateSummary}"/>
</Grid>
上面的代碼給了我不可見的專案背景

如何使背景可見?
uj5u.com熱心網友回復:
根據此,
您必須在元素的資源中設定樣式。在我的情況下,它是一個視窗。所以是
<Window.Resources>
<Style x:Key="ComboBoxItemStyle" TargetType="ComboBoxItem">
<Setter Property="Background" Value="Blue" />
</Style>
<Style x:Key="ComboBoxStyle" TargetType="ComboBox">
<Setter Property="ItemContainerStyle" Value="{StaticResource ComboBoxItemStyle}" />
</Style>
</Window.Resources>
為 設定樣式ComboBoxItem。并在設定樣式時使用該樣式ComboBox
然后將組合框樣式應用于元素。
<ComboBox Name="myCmb" Style="{StaticResource ComboBoxStyle}">
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/344990.html
