Move panels on mouse down over element
Posted: 25 Jun 2019, 17:08
I have made some successful strides in my script, and things are coming along nicely.
https://video.twimg.com/ext_tw_video/11 ... bHvI0z.mp4
but I have realised that I need to impliment some sort of drag-drop features, but not as per the documentation.
the documentation seems to be for inventory managment, not changing the margin's of an element.
I am currently using a Grid for the header of my panels, but i am not sure how I would add a 'mouseDown' event exclusivly in the header and adjust the position.
any help is greatly appreciated.
https://video.twimg.com/ext_tw_video/11 ... bHvI0z.mp4
but I have realised that I need to impliment some sort of drag-drop features, but not as per the documentation.
the documentation seems to be for inventory managment, not changing the margin's of an element.
I am currently using a Grid for the header of my panels, but i am not sure how I would add a 'mouseDown' event exclusivly in the header and adjust the position.
any help is greatly appreciated.
Code: Select all
Noesis.Grid Header = new Noesis.Grid
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Top,
Height = 20,
Background = Brushes.SlateGray
};
Header.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Parse("*") });
Header.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
Header.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
Header.Children.Add(new TextBlock { Text = element.Name, VerticalAlignment = VerticalAlignment.Center, Margin = new Thickness(6, 0, 6, 0) });
Header.Children.Add(new Button { Content = "_", Width = 18, Height = 16, Margin = new Thickness(2), Padding = new Thickness(0) });
Header.Children.Add(new Button { Content = "X", Width = 18, Height = 16, Margin = new Thickness(2), Padding = new Thickness(0) });
for (int i = 1; i < Header.Children.Count; i++) { Noesis.Grid.SetColumn((ContentControl)Header.Children[i], i); }
((Button)Header.Children[2]).Click += (object sender, RoutedEventArgs args) =>
{
uiRoot.Children.Remove(Window);
ActiveWindows.Remove(WindowId);
};