Reputation: 27397
I create WPF application. I want to create borderless window. For that my code as follow
<Window x:Class="AzLeks.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ResizeMode="CanMinimize" Height="600.586" Width="826.694" WindowStyle="None" AllowsTransparency="False"
MouseLeftButtonDown="MainWindow_OnMouseLeftButtonDown" Loaded="Window_Loaded"
WindowStartupLocation="CenterScreen">
<!--<Window.Background>
<ImageBrush ImageSource="images/bckgr.png" />
</Window.Background>-->
<Window.Resources>
<Style x:Key="Close" TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid Margin="-9,-13,-9,-16" HorizontalAlignment="Center" Background="Transparent" VerticalAlignment="Center" Height="630" Width="845">
<Grid.RowDefinitions>
<RowDefinition Height="235*" />
<RowDefinition />
</Grid.RowDefinitions>
<Border CornerRadius="12" BorderBrush="Transparent" BorderThickness="1" >
<Border.Background>
<ImageBrush ImageSource="/images/bckgr.png"></ImageBrush>
</Border.Background>
</Border>
<!--Some Content-->
</Grid>
In design mode it shown as follow:
But after runing the app it shown as:
I don't know what is a problem here. PLease help me, I can't find solution for this
Upvotes: 1
Views: 1571
Reputation: 2875
Something like this.
<Window x:Class="AzLeks.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ResizeMode="CanMinimize" Height="600" Width="820" WindowStyle="None" AllowsTransparency="True" Background="Transparent" MouseLeftButtonDown=" MainWindow_OnMouseLeftButtonDown" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">
<Window.Resources>
<Style x:Key="Close" TargetType="Button">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Background" Value="Red" />
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Border CornerRadius="12" BorderBrush="Transparent" BorderThickness="1" >
<Border.Background>
<ImageBrush ImageSource="/images/bckgr.png"></ImageBrush>
</Border.Background>
<Grid HorizontalAlignment="Center" Background="Transparent" VerticalAlignment="Center" >
<Grid.RowDefinitions>
<RowDefinition Height="235*" />
<RowDefinition />
</Grid.RowDefinitions>
<!--Some Content-->
</Grid>
</Border>
Upvotes: 2