Hello
I want to draw Border with dotted line. How to do such case?
I dont wat to use Rectangle but Border.
<Border></Border>
Hello
I want to draw Border with dotted line. How to do such case?
I dont wat to use Rectangle but Border.
<Border></Border>
As far as I know, it's not possible to do it with <Border>
However, with a Rectangle, where you don't specify the Fill (thus, the Fill remains transparent), it's exactly what you want. Why do you want to avoid <Rectangle/> ?
I want to get official info, how it is about <Border>. I could not find anything valuable in net about this topic.
Those which can draw dotted lines need to inherit from the Shape class, but the Border inherits from FrameworkElement. Can you tell us why do you need to use Border to draw dotted lines?
Hello,
Welcome to Microsoft Q&A!
Draw border with dotted line.
Those which can draw dotted lines need to inherit from the Shape class, but the Border inherits from FrameworkElement. So you can't draw a Border with dotted line.
But Rectangle for example cant carry any context.
Rectangle can't add any child content, as a simple workaround, you can put the Rectangle and TextBlock in a Grid, let the TextBlock overlay on the Rectangle. For example:
<Grid Width="200" Height="200">
<Rectangle StrokeDashArray="1.0 1.0"
Stroke="Red"
StrokeThickness="2"
Width="200" Height="200">
</Rectangle>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center">hello</TextBlock>
</Grid>
I actually wanted to suggest something similar. I do believe he wants something else. Basically, to put the dotted line exactly around the text. But it could hypothetically do that, only after knowing the Width/height of the text.
So, we'd need to bind using ElementName. I know I've had issues in the past using ElementName in UWP, but I believe it could work
13 people are following this question.
How to write and read multiple types of data using Data Writer and Data Reader
Consuming UWP mail api from WPF Desktop Bridge App
Get Network usage information in UWP apps
How to Get/Set Cookies in Windows.Web.Http API
Switch the ListView Datatemplate from one data template to another data template?