<Window x:Class="YourNamespace.YourWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Your Window Title" Height="400" Width="600"
ResizeMode="NoResize">
<!-- Window content goes here -->
</Window>
<Window x:Class="YourNamespace.YourWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Your Window Title" Height="400" Width="600"
Window >
<!-- Window content goes here -->
</Window>
public partial class YourWindow : Window
{
private bool isResizing = false;
private Point resizeStartPoint;
public YourWindow()
{
InitializeComponent();
MouseDown += Window_MouseDown;
MouseMove += Window_MouseMove;
MouseUp += Window_MouseUp;
}
private void Window_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
isResizing = true;
resizeStartPoint = e.GetPosition(this);
}
}
private void Window_MouseMove(object sender, MouseEventArgs e)
{
if (isResizing)
{
Point currentPoint = e.GetPosition(this);
double deltaX = currentPoint.X - resizeStartPoint.X;
double deltaY = currentPoint.Y - resizeStartPoint.Y;
Width += deltaX;
Height += deltaY;
}
}
private void Window_MouseUp(object sender, MouseButtonEventArgs e)
{
isResizing = false;
}
}