layout - How to make clickable color areas with rounded corners in WPF, Button or Border/Textarea? -
I have areas of four colors that are clickable. I get text fields in a border to get color fields But I do not have any one click event so I can make the whole thing a button, but it does not have spherical corners and I do not see the background change.
What is the recommended way to go about this, what I have done so far:
& Lt; Setter property = "horizontal alignment" value = "center" /> & Lt; Setter Property = "Workspace Tracing" Value = "Center" /> & Lt; / Style & gt; & Lt; /UniformGrid.Resources> & Lt; Button border = "1px" margin = "10" borderbrush = "blue" cornerreadia = "33" background = "orange" & gt; Testing 1 & lt; / Button & gt; & Lt; Border border exception = "1px" margin = "10" borderbrush = "blue" cornerreadia = "10" background = "yellow" & gt; & Lt; TextBlock & gt; Testing2 & lt; / TextBlock & gt; & Lt; / Border & gt; & Lt; Border borderchurch = "1px" margin = "10" borderbrush = "blue" cornerreadia = "10" background = "light blue" & gt; & Lt; TextBlock & gt; Testing3 & lt; / TextBlock & gt; & Lt; / Border & gt; & Lt; Border border exception = "1px" margin = "10" borderbrush = "blue" cornerreadia = "10" background = "light green" & gt; & Lt; TextBlock & gt; Testing4 & lt; / TextBlock & gt; & Lt; / Border & gt; & Lt; / UniformGrid & gt; & Lt; / Window & gt;
You must define a custom template for your button
For example:
Uniform grid & gt; & Lt; UniformGrid.Resources & gt; & Lt; ControlTemplate x: key = "buttontump" & gt; & Lt; Border margin = "10" cornerreadia = "10" background = "yellow" & gt; & Lt; TextBlock Text = "{TemplateBinding Button.Content}" /> & Lt; / Border & gt; & Lt; / ControlTemplate & gt; & Lt; /UniformGrid.Resources> & Lt; Button Template = "{static resource button type}" & gt; Testing 1 & lt; / Button & gt; & Lt; / UniformGrid & gt;
Also view
Comments
Post a Comment