Tuesday 8 January 2013

how to create round edge window in WPF Application?




Following XAML to make round edge window in WPF.



Required windows properties set to 


        WindowStyle="None"
        AllowsTransparency="True"
        Background="Transparent"


Then add border control to in windows content
Border syntax is as follows
<Border Name="windowBorder" BorderThickness="2" BorderBrush="DarkBlue" CornerRadius="20" Background="LightBlue">

  </Border>

If you want to design inside the window add grid control or use other layout control to design what you want to wish.

The all code is shown as below


<Window x:Class="NoneBorder.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Withought Border"
        Height="350" Width="525"
        WindowStyle="None"
        AllowsTransparency="True"
        Background="Transparent">
    <Border Name="windowBorder" BorderThickness="2" BorderBrush="DarkBlue" CornerRadius="20" Background="LightBlue">
        <Grid>
            <Button Content="Close" Height="23" HorizontalAlignment="Right" Margin="0,53,121,0" Name="btnClose" VerticalAlignment="Top" Width="75" Click="btnClose_Click" />
        </Grid>  
    </Border>
</Window>



The window is looks like as follows.







1 comment: