private void BtnZone_Click(object sender, RoutedEventArgs e) { var startupLocation = Control.MousePosition; startupLocation.X += 50; // Create the view and add it to the list of managed views var view = ClickZoneView.Show(startupLocation, 100, 100, true); _managedClickZoneViews.Add(view); }
/// <summary> /// Constructs and shows a new click-zone view using the supplied parameters. /// </summary> /// <param name="startingPosition">The coordinates of the top-left corner of the window.</param> /// <param name="width">The width of the window.</param> /// <param name="height">The height of the window.</param> /// <param name="isEnabled">Indicates if the window is enabled or disabled for changes to sizing and location.</param> /// <returns>Returns a newly constructed click-zone view that is now shown.</returns> public static ClickZoneView Show(Drawing.Point startingPosition, int width, int height, bool isEnabled) { var model = new ClickZoneViewModel() { Width = width, Height = height, StartingPosition = startingPosition, EnableChanges = isEnabled }; // Construct the view, show it, and return it. var view = new ClickZoneView(model); view.Show(); return(view); }