I have a WPF application that is borderless so I needed to create my own buttons for windows functions and needed to add a MouseDown
event to allow application to move when clicked and dragged.
The document outline is:
Window grid canvas grid stackPanel - this is where my windows close max and min buttons are.
here is the code for the StackPanel
:
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Canvas.Left="689" Canvas.Top="5">
<TextBlock x:Name="Minimize" Text="0" FontFamily="Webdings" Foreground="Black" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0" MouseLeftButtonUp="Minimize_MouseLeftButtonUp"/>
<TextBlock x:Name="Maximize" Text="1" FontFamily="Webdings" Foreground="Black" Margin="5,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Right" MouseLeftButtonUp="Maximize_MouseLeftButtonUp"/>
<TextBlock x:Name="Close" Text="r" FontFamily="Webdings" Foreground="Black" Margin="5,0,0,0" VerticalAlignment="Top" HorizontalAlignment="Right" MouseLeftButtonUp="Close_MouseLeftButtonUp"/>
</StackPanel>
When I add the MouseDown
dragmove method, it cancels out the StackPanel
and does not allow me to close the application as shown in the code above.
I think the document outline needs a specific order? need some help with maybe understanding how it prioritizes the event handlers
and if I need to rearrange my document outline.