I'm creating a WPF application with a borderless window. Applying the MVVVM
pattern (with help of Caliburn.Micro) I do not have a code behind file but only a XAML file.
In several posts I found following solution:
XAML:
<Window
...
WindowStyle="None" MouseLeftButtonDown="WindowMouseLeftButtonDown"/>
Code behind:
private void WindowMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
Now I'm searching a solution to define this completely in XAML.
Any idea?
The solution I will present is not really advised, but you can put your code behind right in your XAML file like this:
<Window
...
WindowStyle="None" MouseLeftButtonDown="WindowMouseLeftButtonDown"/>
<x:Code>
<![CDATA[
private void WindowMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragMove();
}
]]>
</x:Code>
Check this Codeproject article for more information on this!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With