public RectangleSelector() { changeModeCommand = new LambdaCommand((param) => ChangeModeExecute(param), ChangeModeCanExecute); renderPanel.Children.Add(rectangleControl); rectangleControl.SetBinding(ViewportPanel.ViewportBoundsProperty, new Binding("SelectedRectangle") { Source = this }); InitializeComponent(); }
public PointSelector() { markerChart.SetBinding(Panel.ZIndexProperty, new Binding("(Panel.ZIndex)") { Source = this }); // initializing built-in commands removePointCommand = new LambdaCommand((param) => RemovePointExecute(param), RemovePointCanExecute); changeModeCommand = new LambdaCommand((param) => ChangeModeExecute(param), ChangeModeCanExecute); addPointCommand = new LambdaCommand((param) => AddPointExecute(param), AddPointCanExecute); InitializeComponent(); // adding context menu binding to markers markerChart.AddPropertyBinding(DefaultContextMenu.PlotterContextMenuProperty, data => { ObjectCollection menuItems = new ObjectCollection(); MenuItem item = new MenuItem { Header = UIResources.PointSelector_RemovePoint, Command = PointSelectorCommands.RemovePoint, CommandTarget = this }; item.SetBinding(MenuItem.CommandParameterProperty, new Binding()); menuItems.Add(item); return menuItems; }); // loading marker template var markerTemplate = (DataTemplate)Resources["markerTemplate"]; markerChart.MarkerBuilder = new TemplateMarkerGenerator(markerTemplate); markerChart.ItemsSource = points; // adding bindings to commands from PointSelectorCommands static class CommandBinding removePointBinding = new CommandBinding( PointSelectorCommands.RemovePoint, RemovePointExecute, RemovePointCanExecute ); CommandBindings.Add(removePointBinding); CommandBinding changeModeBinding = new CommandBinding( PointSelectorCommands.ChangeMode, ChangeModeExecute, ChangeModeCanExecute); CommandBindings.Add(changeModeBinding); CommandBinding addPointBinding = new CommandBinding( PointSelectorCommands.AddPoint, AddPointExecute, AddPointCanExecute); CommandBindings.Add(addPointBinding); // init add point menu item addPointMenuItem.Click += addPointMenuItem_Click; points.CollectionChanged += points_CollectionChanged; }
public PointSelector() { markerChart.SetBinding(Panel.ZIndexProperty, new Binding("(Panel.ZIndex)") { Source = this }); // initializing built-in commands removePointCommand = new LambdaCommand((param) => RemovePointExecute(param), RemovePointCanExecute); changeModeCommand = new LambdaCommand((param) => ChangeModeExecute(param), ChangeModeCanExecute); addPointCommand = new LambdaCommand((param) => AddPointExecute(param), AddPointCanExecute); InitializeComponent(); // adding context menu binding to markers markerChart.AddPropertyBinding(DefaultContextMenu.PlotterContextMenuProperty, data => { ObjectCollection menuItems = new ObjectCollection(); MenuItem item = new MenuItem { Header = UIResources.PointSelector_RemovePoint, Command = PointSelectorCommands.RemovePoint, CommandTarget = this }; item.SetBinding(MenuItem.CommandParameterProperty, new Binding()); menuItems.Add(item); return(menuItems); }); // loading marker template var markerTemplate = (DataTemplate)Resources["markerTemplate"]; markerChart.MarkerBuilder = new TemplateMarkerGenerator(markerTemplate); markerChart.ItemsSource = points; // adding bindings to commands from PointSelectorCommands static class CommandBinding removePointBinding = new CommandBinding( PointSelectorCommands.RemovePoint, RemovePointExecute, RemovePointCanExecute ); CommandBindings.Add(removePointBinding); CommandBinding changeModeBinding = new CommandBinding( PointSelectorCommands.ChangeMode, ChangeModeExecute, ChangeModeCanExecute); CommandBindings.Add(changeModeBinding); CommandBinding addPointBinding = new CommandBinding( PointSelectorCommands.AddPoint, AddPointExecute, AddPointCanExecute); CommandBindings.Add(addPointBinding); // init add point menu item addPointMenuItem.Click += addPointMenuItem_Click; points.CollectionChanged += points_CollectionChanged; }