Last active
August 29, 2015 14:19
-
-
Save dbuksbaum/85ad1acaa9c15aa5cecb to your computer and use it in GitHub Desktop.
Irregular Shaped Windows in WPF
This file contains hidden or 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
| public partial class Window1 : Window | |
| { | |
| public Window1() | |
| { | |
| InitializeComponent(); | |
| } | |
| private void Window_MouseDown(object sender, MouseButtonEventArgs e) | |
| { | |
| if (e.ChangedButton == MouseButton.Left) | |
| DragMove(); | |
| } | |
| private void mnuExit_Click(object sender, RoutedEventArgs e) | |
| { | |
| Close(); | |
| } | |
| private void mnuMinimize_Click(object sender, RoutedEventArgs e) | |
| { | |
| WindowState = WindowState.Minimized; | |
| } | |
| } |
This file contains hidden or 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="MyFunSample.Window1" | |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| Title="MyFunSample" | |
| AllowsTransparency="True" | |
| WindowStyle="None" | |
| Background="Transparent" | |
| ResizeMode="CanMinimize" | |
| MouseDown="Window_MouseDown"> | |
| <Window.ContextMenu> | |
| <ContextMenu> | |
| <MenuItem Header="Minimize" Name="mnuMinimize" Click="mnuMinimize_Click"/> | |
| <MenuItem Header="Exit" Name="mnuExit" Click="mnuExit_Click"/> | |
| </ContextMenu> | |
| </Window.ContextMenu> | |
| <Border CornerRadius="20,20,20,20" Background="Cornsilk"/> | |
| </Window> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment