xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ModernWindow" Height="300" Width="300"
AllowsTransparency="True" Background="Transparent"
WindowStyle="None" ResizeMode="CanResizeWithGrip">
BorderBrush="#395984"
BorderThickness="1"
CornerRadius="0,20,30,40" >
MouseLeftButtonDown="window_initiateWiden"
MouseLeftButtonUp="window_endWiden"
MouseMove="window_Widen"/>
//File:Window.xaml.cs
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Windows
{
public partial class ModernWindow : System.Windows.Window
{
public ModernWindow()
{
InitializeComponent();
}
bool isWiden = false;
private void window_initiateWiden(object sender, System.Windows.Input.MouseEventArgs e)
{
isWiden = true;
}
private void window_endWiden(object sender, System.Windows.Input.MouseEventArgs e)
{
isWiden = false;
Rectangle rect = (Rectangle)sender;
rect.ReleaseMouseCapture();
}
private void window_Widen(object sender, System.Windows.Input.MouseEventArgs e)
{
Rectangle rect = (Rectangle)sender;
if (isWiden)
{
rect.CaptureMouse();
double newWidth = e.GetPosition(this).X + 5;
if (newWidth > 0) this.Width = newWidth;
}
}
private void titleBar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}
private void cmdClose_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
}
}