Not able to Style my WPF Controls -
I'm getting mad here! What is missing me and why is not she styling anything:
style x: key = "textbox type" targettype = "{x: type textbox}" & gt; & Lt; Style.Triggers & gt; & Lt; Trigger Property = "IFococled" Value = "True" & gt; & Lt; Setter property = "background" value = "red" /> & Lt; / Catalyst & gt; & Lt; /Style.Triggers> & Lt; / Style & gt; & Lt; Width of text box = "100" style = "{static resource text box style}" height = "20" background = "yellow" & gt; & Lt; / Textbox & gt;
The above code does not do anything. This text box does not reveal control!
This is because local values override style values. (The properties set directly on an element are of very high priority.) You are setting the background directly on the text box, so going WPF, "OK, it would generally like that the text box styled background is red on the red But for this special text box, he said that the background should be yellow, and therefore yellow. "
It is certain that the yellow background to be a part of the genre:
& lt; Style x: key = "textbox style" target type = "{x: type text box}" & gt; & Lt; Setter property = "background" value = "yellow" /> & Lt; Style.Triggers & gt; & Lt; Trigger Property = "IFococled" Value = "True" & gt; & Lt; Setter property = "background" value = "red" /> & Lt; / Catalyst & gt; & Lt; /Style.Triggers> & Lt; / Style & gt;
and remove it from the textbox:
& lt; Text box width = "100" style = "{StaticResource textBoxStyle}" height = "20" />
Comments
Post a Comment