Share:

Create Custom Shaped Window C# WPF | Saatody | Amit Padhiyar

First we need to set some properties for window. The property WindowStyle will be None. Property AllowsTransparency will be true. WindowStartupLocation property will be CenterScreen. And The Background will be Transparent.

Now you need to use Clip property for window reshape.

<Window x:Class="Saatody.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Saatody"
Title="MainWindow" Height="500" Width="500" WindowStyle="None" AllowsTransparency="True" WindowStartupLocation="CenterScreen" Background="Transparent"> <Window.Clip> <PathGeometry> <PathGeometry.Figures> <PathFigure StartPoint="0,0" IsClosed="True"> <LineSegment Point="500,0"/> <LineSegment Point="500,100"/> <LineSegment Point="100,100"/> <LineSegment Point="100,200"/> <LineSegment Point="500,200"/> <LineSegment Point="500,300"/> <LineSegment Point="100,300"/> <LineSegment Point="100,500"/> <LineSegment Point="0,500"/> </PathFigure> </PathGeometry.Figures> </PathGeometry> </Window.Clip> <Grid> <Grid.Background> <ImageBrush ImageSource="Img1.png" Stretch="UniformToFill"/> </Grid.Background> </Grid> </Window>

Comments

Popular posts from this blog

Get Color From Pixel C# WPF | Saatody | Amit Padhiyar

Basic Audio Operations With MP3 And Wave Files Using NAudio C#

Create Drag And Drop Operation Between DevExpress GridControl And Custom WPF UI | Saatody | Amit Padhiyar