wpf - How can I define and use a variable in XAML to define a color? -
I have a number of elements in the XAML that defines Foreground = "# 555" Color of fade text in a readable text box for
& Lt; Text boxes Text = "{Binding SingularModelClassFileName}" HorizontalAlignment = "left" IsReadOnly = "True" foreground = "# 555" width = "500" / & gt; & Lt; Textbox VerticalScrollBarVisibility = "visible" AcceptsReturn = "true" width = "500" height = "100" IsReadOnly = "True" foreground = "# 555" Text = "{SingularModelClassContent Binding}" HorizontalAlignment = "left" margin = "0 20" />
How can I assume I can put in a XAML variable and I can refer to each attribute so I'll have to change it in one place?
I'm thinking you can do something like this :
& lt; Sys: string x: main = "ReadOnlyTextColor" & gt; # 555 & lt; / Sys: string & gt; ... & lt; Text box foreground = "{static resource readline text file"} />
and property xmlns: sys = ...
What will be the context for this?
Try to define your colors as a:
< Code> & lt; SolidColorBrush x: key = "ReadOnlyTextBrush" color = "# 555555" />
...
& lt; Text box foreground = "{static resource readline text file}" />
Comments
Post a Comment