c# - User control or custom control for this design? -


If I want to create a button control like that, then it is considered to be a user control Or a custom control? I'm not sure maybe anything else? Ideally I want to be able to separate the main style and interior button; It also needs to be clearly processed separately for its events. These buttons will be built at run-time and the sick will have to set the mouse dynamically

I suggest a user control. You can still make your original style in xaml and use code for dynamic stuff.

You basically want something like this:

  & lt; Button & gt; & Lt; Grid & gt; & Lt; Grid.ColumnDefinitions & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; Columns Definition / & gt; & Lt; /Grid.ColumnDefinitions> & Lt; Image Source = "Grid" Column = "0" /> & Lt; TextBlock Grid.Column = "1" & gt; Your button text & lt; / TextBlock & gt; & Lt; Image Source = "Grid" Column = "2" /> & Lt; / Grid & gt; & Lt; / Button & gt;  

Comments