C
C#16mo ago
Kai

✅ X within ellipse

So I want to make a custom close button since my app is using WindowStyle=None This is the XAML for the X:
<Grid
Grid.Row="0"
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="10"
MouseLeftButtonDown="Ellipse_MouseLeftButtonDown">
<Ellipse Fill="Red"
Height="25"
Width="25"/>
<TextBlock Text="X"
Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="14"
FontWeight="Bold"
FontFamily="Fonts/#Rubik"/>
</Grid>
<Grid
Grid.Row="0"
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="10"
MouseLeftButtonDown="Ellipse_MouseLeftButtonDown">
<Ellipse Fill="Red"
Height="25"
Width="25"/>
<TextBlock Text="X"
Foreground="White"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="14"
FontWeight="Bold"
FontFamily="Fonts/#Rubik"/>
</Grid>
However, something just doesn't look right.. Is there a better / more ellegant way?
No description
3 Replies
Jester
Jester16mo ago
How to: Draw a Line - WPF .NET Framework
Learn how to draw a Line by creating a Line element and using its X1 and Y1 properties to set its start point and its X2 and Y2 properties to set its end point.
Will
Will16mo ago
if the offset/scale of it is bothering you, you could also use its RenderTransform to adjust it manually there are also fonts like webdings and wingdings that have X icons
Kai
KaiOP16mo ago
that worked, thanks

Did you find this page helpful?