Problem in write ControlTemplate in C#

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.
 
J

Jesse Houwing

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top