I am having an issue with the BorderThickness or BorderBrush property in Windows 8.
In win7, the code below correctly outlines editControl in a 5px thick read outline, however it does not work in windows 8. I am wondering if there is something deprecated or unsupported in windows 8 now? I cannot find any notion of that on the microsoft documentation.
editControl.BorderThickness = new Thickness(5);
editControl.BorderBrush = Brushes.Red;
Anyone able to help?
I found a workaround using using Adorners .
private class ErrorHighlightAdorner : Adorner
{
public ErrorHighlightAdorner(UIElement adornedElement)
: base(adornedElement)
{
}
protected override void OnRender(DrawingContext drawingContext)
{
Rect sourceRect = new Rect();
FrameworkElement fe = AdornedElement as FrameworkElement;
if (fe != null)
{
sourceRect = new Rect(fe.RenderSize);
}
else
{
sourceRect = new Rect(AdornedElement.DesiredSize);
}
Pen renderPen = new Pen(new SolidColorBrush(Colors.Red), 2.0);
drawingContext.DrawRectangle(null, renderPen, sourceRect);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.