Situation
You’re creating some kind of control that needs to be sharply visible.
Problem
WPF uses anti-aliasing on default so the control is rendered “soft”.
Solution
Deactivate anti-aliasing for the whole WPF application, the control or the specific part that needs to be sharp by setting the EdgeModeProperty to aliased.
Sample
/// <summary>
/// Interaction logic for LogicControl.xaml
/// </summary>
public partial class LogicControl : UserControl
{
/// <summary>
/// Creates a new instance.
/// </summary>
public LogicControl()
{
InitializeComponent();
this.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
}
}
Sources
Leave a Reply