Example for changing appearance of the Control in WPF Application.


Here I am explaining how to apply Font Weight, Font Size & Background for a Button control in WPF application using XAML & also through code.

Here I am explaining how to apply Font Weight, Font Size & Background for a Button control in WPF application using XAML & also through code.

The following code sets Font Weight, Font Size & background for Button control in WPF application:



Create an object for LinearGradientBrush & set Start Point & Endpoint:


LinearGradientBrush LGbtnBrush = new LinearGradientBrush();
LGbtnBrush.StartPoint = new Point(0, 1.5);
LGbtnBrush.EndPoint = new Point(1, 2.5);
LGbtnBrush.GradientStops.Add(new GradientStop(Colors.Red, 0));
LGbtnBrush.GradientStops.Add(new GradientStop(Colors.Blue, 1.5));


Take a Button Control on to the Form from Tool bar menu & named as btnSubmit:


btnSubmit.Background = LGbtnBrush;
btnSubmit.FontSize = 18;
btnSubmit.FontWeight = FontWeights.Bold;



Using XAML:










Thank you...


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: