Problem in write ControlTemplate in C#

  • Thread starter Thread starter goingbbs
  • Start date Start date
G

goingbbs

Hi,

I have tried many methods to convert the XAML control template to c_sharp
language, but failed.

Could you kindly give me some advice or comment?

The XAML code is shown followed which is needed to re-write in C#.


<ControlTemplate TargetType=Button">
<Rectangle>
<Rectangle.Fill>
<ImageBrush
ImageSource="../Resources/Images/login2.png"/>
</Rectangle.Fill>
</Rectangle>
</ControlTemplate>

Thank u for your help.
 
Hello (e-mail address removed),
Hi,

I have tried many methods to convert the XAML control template to
c_sharp language, but failed.

Could you kindly give me some advice or comment?

The XAML code is shown followed which is needed to re-write in C#.

<ControlTemplate TargetType=Button">
<Rectangle>
<Rectangle.Fill>
<ImageBrush
ImageSource="../Resources/Images/login2.png"/>
</Rectangle.Fill>
</Rectangle>
</ControlTemplate>
Thank u for your help.

I don't really understand what you're trying to do...

Do you need to create a similar lookin button for a standard windows forms
application?

In that case you'll need to inhertit from Button and override/hook into the
Paint method to paint it as you would want it to look. Quite a bit of work,
but doable.
 
Back
Top