Created
November 15, 2011 16:39
-
-
Save JoshClose/1367541 to your computer and use it in GitHub Desktop.
Creating a Custom Window in WPF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="CustomWindow.Window1" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" | |
Title="Window1" Height="300" Width="300"> | |
<Grid> | |
</Grid> | |
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="CustomWindow.Window1" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" | |
Title="Window1" Height="300" Width="300" | |
AllowsTransparency="True" WindowStyle="None" Background="Transparent"> | |
<Grid> | |
</Grid> | |
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="CustomWindow.Window1" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" | |
Title="Window1" Height="300" Width="300" | |
AllowsTransparency="True" WindowStyle="None" Background="Transparent"> | |
<Border BorderThickness="1" BorderBrush="Black" Background="White" | |
Margin="0" CornerRadius="10"> | |
</Border> | |
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="CustomWindow.Window1" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" | |
Title="Window1" Height="300" Width="300" | |
AllowsTransparency="True" WindowStyle="None" Background="Transparent"> | |
<Border BorderThickness="1" BorderBrush="Black" Background="White" | |
Margin="0" CornerRadius="10"> | |
<Border Height="40" Background="#01000000" VerticalAlignment="Top" | |
CornerRadius="10,10,0,0" MouseLeftButtonDown="DragWindow"/> | |
</Border> | |
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows; | |
using System.Windows.Input; | |
namespace CustomWindow | |
{ | |
/// <summary> | |
/// Interaction logic for Window1.xaml | |
/// </summary> | |
public partial class Window1 : Window | |
{ | |
public Window1() | |
{ | |
InitializeComponent(); | |
} | |
protected void DragWindow( object sender, MouseButtonEventArgs e ) | |
{ | |
DragMove(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="CustomWindow.Window1" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:aero="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" | |
Title="Window1" Height="300" Width="300" | |
AllowsTransparency="True" WindowStyle="None" Background="Transparent"> | |
<aero:SystemDropShadowChrome CornerRadius="10" Margin="10"> | |
<Border BorderThickness="1" BorderBrush="Black" Background="White" | |
Margin="0" CornerRadius="10"> | |
<Border Height="40" Background="#01000000" VerticalAlignment="Top" | |
CornerRadius="10,10,0,0" MouseLeftButtonDown="DragWindow"/> | |
</Border> | |
</aero:SystemDropShadowChrome> | |
</Window> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment