Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

How to change background color of a combobox in disabled mode ?

$
0
0

Hi all.

I'm quite new to WPF,

now struggling with trying to change the background of a combobox when disabled.

It should be transparent and not white.

I went over all the examples here and nothing solved my problem...

I'm using ResourceDictionary (ComboBox.xaml),

and noticed 4 style parts in ComboBoxes: The comboBox itself, ComboBoxToggleButton, ComboBoxItem, ComboBoxTextBox.

What I need is probably just the ComboBoxTextBox or ComboBox style, because the

ComboBoxItem is okay.

Basically, I added these lines to each of the 4 parts:

What it does it just change a tiny part around the text box itself, like a thin frame around it, and the rest stays white...

<TriggerProperty="IsEnabled"Value="false">
<SetterProperty="Background"Value="Transparent"/>

</Trigger>

<TriggerProperty="IsEnabled"Value="true">

<SetterProperty="Background"Value="White"/>

</Trigger>

It doesn't help, nor trying to write it in the codebehind or in the window xaml itself as:

<ComboBox.Style><Style TargetType="{x:Type ComboBox}" ><Style.Triggers><Trigger Property="IsEnabled" Value="False"><Setter Property="Background" Value="Transparent"/></Trigger><Trigger Property="IsReadOnly" Value="False"><Setter Property="Background" Value="Transparent"/></Trigger></Style.Triggers></Style></ComboBox.Style>
















Can anyone shed light on this ?

Thanks a lot !!!

Ronit.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>