public override void SetupCustomUIElements(dynNodeView ui) { var nodeUI = ui; base.SetupCustomUIElements(nodeUI); //add a text box to the input grid of the control var tb = new StringTextBox { AcceptsReturn = true, AcceptsTab = true, TextWrapping = TextWrapping.Wrap, MaxWidth = 200, VerticalAlignment = VerticalAlignment.Stretch }; nodeUI.inputGrid.Children.Add(tb); Grid.SetColumn(tb, 0); Grid.SetRow(tb, 0); tb.DataContext = this; tb.BindToProperty(new Binding("Value") { Mode = BindingMode.TwoWay, Converter = new StringDisplay(), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }); }
public void SetupCustomUIElements(dynNodeView nodeUI) { var addButton = new DynamoNodeButton(this, "AddInPort"); addButton.Content = "+"; addButton.Width = 20; addButton.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; addButton.VerticalAlignment = System.Windows.VerticalAlignment.Center; var subButton = new DynamoNodeButton(this, "RemoveInPort"); subButton.Content = "-"; subButton.Width = 20; subButton.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; subButton.VerticalAlignment = System.Windows.VerticalAlignment.Top; var wp = new WrapPanel { VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Center }; wp.Children.Add(addButton); wp.Children.Add(subButton); nodeUI.inputGrid.Children.Add(wp); }
public override void SetupCustomUIElements(dynNodeView nodeUI) { //add a text box to the input grid of the control tb = new TextBox(); tb.HorizontalAlignment = HorizontalAlignment.Stretch; tb.VerticalAlignment = VerticalAlignment.Center; nodeUI.inputGrid.Children.Add(tb); Grid.SetColumn(tb, 0); Grid.SetRow(tb, 0); //turn off the border var backgroundBrush = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); tb.Background = backgroundBrush; tb.BorderThickness = new Thickness(0); tb.DataContext = this; var bindingSymbol = new Binding("Symbol") { Mode = BindingMode.TwoWay, Converter = new StringDisplay() }; tb.SetBinding(TextBox.TextProperty, bindingSymbol); tb.TextChanged += tb_TextChanged; }
public override void SetupCustomUIElements(dynNodeView nodeUI) { watchTree = new WatchTree(); nodeUI.grid.Children.Add(watchTree); watchTree.SetValue(Grid.RowProperty, 2); watchTree.SetValue(Grid.ColumnSpanProperty, 3); watchTree.Margin = new Thickness(5, 0, 5, 5); Root = new WatchNode(); watchTree.DataContext = Root; this.RequestBindingUnhook += new EventHandler(delegate { BindingOperations.ClearAllBindings(watchTree.treeView1); }); this.RequestBindingRehook += new EventHandler(delegate { var sourceBinding = new Binding("Children") { Mode = BindingMode.TwoWay, Source = Root, }; watchTree.treeView1.SetBinding(TreeView.ItemsSourceProperty, sourceBinding); }); }
public void SetupCustomUIElements(dynNodeView nodeUI) { //add an edit window option to the //main context window var editWindowItem = new System.Windows.Controls.MenuItem(); editWindowItem.Header = "Edit..."; editWindowItem.IsCheckable = false; nodeUI.MainContextMenu.Items.Add(editWindowItem); editWindowItem.Click += new RoutedEventHandler(editWindowItem_Click); //add a text box to the input grid of the control var tb = new DynamoTextBox(); tb.HorizontalAlignment = HorizontalAlignment.Stretch; tb.VerticalAlignment = VerticalAlignment.Center; nodeUI.inputGrid.Children.Add(tb); Grid.SetColumn(tb, 0); Grid.SetRow(tb, 0); tb.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF)); tb.DataContext = this; tb.BindToProperty(new System.Windows.Data.Binding("Value") { Mode = BindingMode.TwoWay, Converter = new MeasureConverter(), ConverterParameter = _measure, NotifyOnValidationError = false, Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }); tb.OnChangeCommitted += delegate { RequiresRecalc = true; }; ((PreferenceSettings)dynSettings.Controller.PreferenceSettings).PropertyChanged += PreferenceSettings_PropertyChanged; }
public void SetupCustomUIElements(dynNodeView view) { var drawPlane = new Image { Stretch = Stretch.Fill, HorizontalAlignment = HorizontalAlignment.Stretch, Width = 100, Height = 200 }; var dm = this.Workspace.DynamoModel; view.inputGrid.Children.Add(drawPlane); RequestChangeColorRange += delegate { DispatchOnUIThread(delegate { var colorStartNode = InPorts[0].Connectors[0].Start.Owner; var startIndex = InPorts[0].Connectors[0].Start.Index; var colorEndNode = InPorts[1].Connectors[0].Start.Owner; var endIndex = InPorts[1].Connectors[0].Start.Index; var startId = colorStartNode.GetAstIdentifierForOutputIndex(startIndex).Name; var endId = colorEndNode.GetAstIdentifierForOutputIndex(endIndex).Name; var startMirror = dm.EngineController.GetMirror(startId); var endMirror = dm.EngineController.GetMirror(endId); object start = null; object end = null; if (startMirror.GetData().IsCollection) { start = startMirror.GetData().GetElements().Select(x => x.Data).FirstOrDefault(); } else { start = startMirror.GetData().Data; } if (endMirror.GetData().IsCollection) { end = endMirror.GetData().GetElements().Select(x => x.Data).FirstOrDefault(); } else { end = endMirror.GetData().Data; } Color startColor = start as Color; Color endColor = end as Color; if (null != startColor && null != endColor) { WriteableBitmap bmp = CompleteColorScale(startColor, endColor); drawPlane.Source = bmp; } }); }; }
public override void SetupCustomUIElements(dynNodeView nodeUI) { var comboBox = new ComboBox { MinWidth = 150, Padding = new Thickness(8), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center }; nodeUI.inputGrid.Children.Add(comboBox); Grid.SetColumn(comboBox, 0); Grid.SetRow(comboBox, 0); comboBox.ItemsSource = this.Items; comboBox.SelectedIndex = this.SelectedIndex; comboBox.SelectionChanged += delegate { if (comboBox.SelectedIndex == -1) return; this.RequiresRecalc = true; this.SelectedIndex = comboBox.SelectedIndex; }; }
public void SetupCustomUIElements(dynNodeView nodeUI) { //add a button to the inputGrid on the dynElement _sunPathButt = new DynamoNodeButton { HorizontalAlignment = System.Windows.HorizontalAlignment.Center, VerticalAlignment = System.Windows.VerticalAlignment.Center }; _sunPathButt.Click += new System.Windows.RoutedEventHandler(registerButt_Click); _sunPathButt.Content = "Use SunPath\nfrom Current View"; _sunPathButt.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; _sunPathButt.VerticalAlignment = System.Windows.VerticalAlignment.Center; _tb = new System.Windows.Controls.TextBox { Text = "No SunPath Registered", HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, VerticalAlignment = System.Windows.VerticalAlignment.Center }; var backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0)); _tb.Background = backgroundBrush; _tb.BorderThickness = new Thickness(0); _tb.IsReadOnly = true; _tb.IsReadOnlyCaretVisible = false; nodeUI.inputGrid.RowDefinitions.Add(new RowDefinition()); nodeUI.inputGrid.RowDefinitions.Add(new RowDefinition()); nodeUI.inputGrid.Children.Add(_tb); nodeUI.inputGrid.Children.Add(_sunPathButt); System.Windows.Controls.Grid.SetRow(_sunPathButt, 0); System.Windows.Controls.Grid.SetRow(_tb, 1); }
public override void SetupCustomUIElements(dynNodeView nodeUI) { var comboBox = new ComboBox { MinWidth = 150, Padding = new Thickness(8), HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center }; nodeUI.inputGrid.Children.Add(comboBox); Grid.SetColumn(comboBox, 0); Grid.SetRow(comboBox, 0); comboBox.ItemsSource = this.Items; comboBox.SelectedIndex = this.SelectedIndex; comboBox.SelectionChanged += delegate { if (comboBox.SelectedIndex == -1) { return; } this.RequiresRecalc = true; this.SelectedIndex = comboBox.SelectedIndex; }; }
public override void SetupCustomUIElements(dynNodeView nodeUI) { //If you have custom UI elements which you want to //add to the node, set them up here. //Add custom UI elements to the NodeUI.InputGrid.Children collection //to have them appear in the center of the node. }
public void SetupCustomUIElements(dynNodeView nodeUI) { //add a text box to the input grid of the control var tb = new DynamoTextBox(Value ?? "0.0") { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Background = new SolidColorBrush(Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF)) }; nodeUI.inputGrid.Children.Add(tb); Grid.SetColumn(tb, 0); Grid.SetRow(tb, 0); tb.DataContext = this; tb.BindToProperty(new Binding("Value") { Mode = BindingMode.TwoWay, Converter = new DoubleInputDisplay(), NotifyOnValidationError = false, Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }); Workspace.DynamoModel.PreferenceSettings.PropertyChanged += Preferences_PropertyChanged; }
public override void SetupCustomUIElements(dynNodeView nodeUI) { //add a text box to the input grid of the control var tb = new DynamoTextBox { Background = new SolidColorBrush(Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF)) }; tb.OnChangeCommitted += processTextForNewInputs; tb.HorizontalAlignment = HorizontalAlignment.Stretch; tb.VerticalAlignment = VerticalAlignment.Top; nodeUI.inputGrid.Children.Add(tb); Grid.SetColumn(tb, 0); Grid.SetRow(tb, 0); tb.DataContext = this; tb.BindToProperty( new Binding("Value") { Mode = BindingMode.TwoWay, Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }); }
public void SetupCustomUIElements(dynNodeView nodeUI) { var addButton = new DynamoNodeButton(this, "AddInPort") { Content = "+", Width = 20 }; //addButton.Height = 20; var subButton = new DynamoNodeButton(this, "RemoveInPort") { Content = "-", Width = 20 }; //subButton.Height = 20; var wp = new WrapPanel { VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Center }; wp.Children.Add(addButton); wp.Children.Add(subButton); nodeUI.inputGrid.Children.Add(wp); }
public void SetupCustomUIElements(dynNodeView nodeUI) { var tb = new CodeNodeTextBox(Code) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Background = new SolidColorBrush(Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF)), AcceptsReturn = true, MaxWidth = Configurations.CBNMaxTextBoxWidth, TextWrapping = TextWrapping.Wrap }; nodeUI.inputGrid.Children.Add(tb); Grid.SetColumn(tb, 0); Grid.SetRow(tb, 0); tb.DataContext = nodeUI.ViewModel; tb.BindToProperty( new Binding("Code") { Mode = BindingMode.TwoWay, NotifyOnValidationError = false, Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }); if (shouldFocus) { tb.Focus(); shouldFocus = false; } }
public void SetupCustomUIElements(dynNodeView nodeUI) { // Do not call 'NodeModel.InitializeUI' here since it will cause // that method to dispatch the call back to 'SetupCustomUIElements' // method, resulting in an eventual stack overflow. // // base.InitializeUI(nodeUI); //add a drop down list to the window var combo = new ComboBox { Width = System.Double.NaN, MinWidth = 100, Height = Configurations.PortHeightInPixels, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center }; nodeUI.inputGrid.Children.Add(combo); Grid.SetColumn(combo, 0); Grid.SetRow(combo, 0); combo.DropDownOpened += combo_DropDownOpened; combo.SelectionChanged += delegate { if (combo.SelectedIndex != -1) { RequiresRecalc = true; } }; combo.DropDownClosed += delegate { //disallow selection of nothing if (combo.SelectedIndex == -1) { SelectedIndex = 0; } }; combo.DataContext = this; //bind this combo box to the selected item hash var bindingVal = new Binding("Items") { Mode = BindingMode.TwoWay, Source = this }; combo.SetBinding(ItemsControl.ItemsSourceProperty, bindingVal); //bind the selected index to the var indexBinding = new Binding("SelectedIndex") { Mode = BindingMode.TwoWay, Source = this }; combo.SetBinding(Selector.SelectedIndexProperty, indexBinding); }
public void SetupCustomUIElements(dynNodeView nodeUI) { var selectionControl = new ElementSelectionControl { DataContext = this }; nodeUI.inputGrid.Children.Add(selectionControl); }
public void SetupCustomUIElements(dynNodeView view) { var locCtrl = new LocationControl { DataContext = this }; view.inputGrid.Children.Add(locCtrl); }
/// <summary> /// UI is initialized and bindings are setup here. /// </summary> /// <param name="nodeUI">UI view that we can customize the UI of.</param> public override void SetupCustomUIElements(dynNodeView nodeUI) { BuildSliderUI(nodeUI, this, Value, SerializeValue(), new DoubleSliderSettingsControl() { DataContext = this }, new DoubleDisplay()); }
public override void SetupCustomUIElements(dynNodeView nodeUI) { //add a button to the inputGrid on the dynElement var selectButton = new DynamoNodeButton() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, Height = Configurations.PortHeightInPixels, }; selectButton.Click += selectButton_Click; var tb = new TextBox { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0)), BorderThickness = new Thickness(0), IsReadOnly = true, IsReadOnlyCaretVisible = false, MaxWidth = 200, TextWrapping = TextWrapping.Wrap }; nodeUI.inputGrid.RowDefinitions.Add(new RowDefinition()); nodeUI.inputGrid.RowDefinitions.Add(new RowDefinition()); nodeUI.inputGrid.Children.Add(tb); nodeUI.inputGrid.Children.Add(selectButton); System.Windows.Controls.Grid.SetRow(selectButton, 0); System.Windows.Controls.Grid.SetRow(tb, 1); tb.DataContext = this; selectButton.DataContext = this; var selectTextBinding = new System.Windows.Data.Binding("SelectionText") { Mode = BindingMode.TwoWay, }; tb.SetBinding(TextBox.TextProperty, selectTextBinding); var buttonTextBinding = new System.Windows.Data.Binding("SelectedElement") { Mode = BindingMode.OneWay, Converter = new SelectionButtonContentConverter(), }; selectButton.SetBinding(ContentControl.ContentProperty, buttonTextBinding); var buttonEnabledBinding = new System.Windows.Data.Binding("CanSelect") { Mode = BindingMode.TwoWay, }; selectButton.SetBinding(Button.IsEnabledProperty, buttonEnabledBinding); }
public override void SetupCustomUIElements(dynNodeView ui) { ((DropShadowEffect) ui.elementRectangle.Effect).Opacity = 1; ((DropShadowEffect) ui.elementRectangle.Effect).Color = Colors.WhiteSmoke; ((DropShadowEffect) ui.elementRectangle.Effect).BlurRadius = 20; ((DropShadowEffect) ui.elementRectangle.Effect).ShadowDepth = 0; ui.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(ui_MouseDoubleClick); }
public override void SetupCustomUIElements(dynNodeView nodeUI) { nodeUI.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(ui_MouseDoubleClick); //var editItem = new MenuItem(); //editItem.Header = "Edit Properties..."; //editItem.Click += EditCustomNodePropertiesClick; //nodeUI.MainContextMenu.Items.Add(editItem); }
public override void SetupCustomUIElements(dynNodeView nodeUI) { this.dynamoViewModel = nodeUI.ViewModel.DynamoViewModel; //add a text box to the input grid of the control var rbTrue = new RadioButton(); var rbFalse = new RadioButton(); rbTrue.VerticalAlignment = VerticalAlignment.Center; rbFalse.VerticalAlignment = VerticalAlignment.Center; //use a unique name for the button group //so other instances of this element don't get confused string groupName = Guid.NewGuid().ToString(); rbTrue.GroupName = groupName; rbFalse.GroupName = groupName; rbTrue.Content = "True"; rbTrue.Padding = new Thickness(0, 0, 12, 0); rbFalse.Content = "False"; rbFalse.Padding = new Thickness(0); var wp = new WrapPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Margin = new Thickness(10, 5, 10, 0), Orientation = Orientation.Horizontal }; wp.Children.Add(rbTrue); wp.Children.Add(rbFalse); nodeUI.inputGrid.Children.Add(wp); //rbFalse.IsChecked = true; rbTrue.Checked += OnRadioButtonClicked; rbFalse.Checked += OnRadioButtonClicked; rbFalse.DataContext = this; rbTrue.DataContext = this; var rbTrueBinding = new Binding("Value") { Mode = BindingMode.TwoWay, }; rbTrue.SetBinding(ToggleButton.IsCheckedProperty, rbTrueBinding); var rbFalseBinding = new Binding("Value") { Mode = BindingMode.TwoWay, Converter = new InverseBoolDisplay() }; rbFalse.SetBinding(ToggleButton.IsCheckedProperty, rbFalseBinding); }
public void SetupCustomUIElements(dynNodeView nodeUI) { this.dynamoViewModel = nodeUI.ViewModel.DynamoViewModel; watchTree = new WatchTree(); // MAGN-2446: Fixes the maximum width/height of watch node so it won't // go too crazy on us. Note that this is only applied to regular watch // node so it won't be limiting the size of image/3D watch nodes. // nodeUI.PresentationGrid.MaxWidth = Configurations.MaxWatchNodeWidth; nodeUI.PresentationGrid.MaxHeight = Configurations.MaxWatchNodeHeight; nodeUI.PresentationGrid.Children.Add(watchTree); nodeUI.PresentationGrid.Visibility = Visibility.Visible; if (Root == null) { Root = new WatchViewModel(this.dynamoViewModel.VisualizationManager); } watchTree.DataContext = Root; RequestBindingUnhook += delegate { BindingOperations.ClearAllBindings(watchTree.treeView1); }; RequestBindingRehook += delegate { var sourceBinding = new Binding("Children") { Mode = BindingMode.TwoWay, Source = Root, }; watchTree.treeView1.SetBinding(ItemsControl.ItemsSourceProperty, sourceBinding); }; var checkedBinding = new Binding("ShowRawData") { Mode = BindingMode.TwoWay, Source = Root }; var rawDataMenuItem = new MenuItem { Header = "Show Raw Data", IsCheckable = true, }; rawDataMenuItem.SetBinding(MenuItem.IsCheckedProperty, checkedBinding); nodeUI.MainContextMenu.Items.Add(rawDataMenuItem); ((PreferenceSettings)this.Workspace.DynamoModel.PreferenceSettings).PropertyChanged += PreferenceSettings_PropertyChanged; Root.PropertyChanged += Root_PropertyChanged; }
public void SetupCustomUIElements(dynNodeView nodeUI) { var mi = new MenuItem { Header = "Show Elements" }; mi.Click += mi_Click; nodeUI.MainContextMenu.Items.Add(mi); }
public virtual void SetupCustomUIElements(dynNodeView nodeUI) { //add an edit window option to the //main context window var editWindowItem = new MenuItem { Header = "Edit...", IsCheckable = false }; nodeUI.MainContextMenu.Items.Add(editWindowItem); editWindowItem.Click += editWindowItem_Click; }
public override void SetupCustomUIElements(dynNodeView view) { base.SetupCustomUIElements(view); var editWindowItem = new MenuItem { Header = "Edit...", IsCheckable = false }; view.MainContextMenu.Items.Add(editWindowItem); editWindowItem.Click += delegate { EditScriptContent(); }; view.UpdateLayout(); view.MouseDown += view_MouseDown; }
public override void SetupCustomUIElements(dynNodeView nodeUI) { watchTree = new WatchTree(); //nodeUI.inputGrid.Children.Add(watchTree); nodeUI.grid.Children.Add(watchTree); watchTree.SetValue(Grid.RowProperty, 2); watchTree.SetValue(Grid.ColumnSpanProperty, 3); watchTree.Margin = new Thickness(5, 0, 5, 5); watchTreeBranch = watchTree.FindResource("Tree") as WatchTreeBranch; }
public void SetupCustomUIElements(dynNodeView nodeUI) { //add a drop down list to the window var combo = new ComboBox { Width = System.Double.NaN, MinWidth = 100, Height = Configurations.PortHeightInPixels, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center }; nodeUI.inputGrid.Children.Add(combo); System.Windows.Controls.Grid.SetColumn(combo, 0); System.Windows.Controls.Grid.SetRow(combo, 0); combo.DropDownOpened += combo_DropDownOpened; combo.SelectionChanged += delegate { if (combo.SelectedIndex != -1) { RequiresRecalc = true; } }; combo.DropDownClosed += delegate { //disallow selection of nothing if (combo.SelectedIndex == -1) { SelectedIndex = 0; } }; combo.DataContext = this; //bind this combo box to the selected item hash var bindingVal = new System.Windows.Data.Binding("Items") { Mode = BindingMode.TwoWay, Source = this }; combo.SetBinding(ItemsControl.ItemsSourceProperty, bindingVal); //bind the selected index to the var indexBinding = new Binding("SelectedIndex") { Mode = BindingMode.TwoWay, Source = this }; combo.SetBinding(Selector.SelectedIndexProperty, indexBinding); }
public void SetupCustomUIElements(dynNodeView nodeUI) { this.ViewModel = nodeUI.ViewModel.DynamoViewModel; VisualizationManager = ViewModel.VisualizationManager; var mi = new MenuItem { Header = "Zoom to Fit" }; mi.Click += mi_Click; nodeUI.MainContextMenu.Items.Add(mi); //add a 3D viewport to the input grid //http://helixtoolkit.codeplex.com/wikipage?title=HelixViewport3D&referringTitle=Documentation //_watchView = new WatchView(); View = new Watch3DView(GUID) { DataContext = this, Width = _watchWidth, Height = _watchHeight }; View.View.Camera.Position = _camPosition; View.View.Camera.LookDirection = _lookDirection; var backgroundRect = new Rectangle { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, IsHitTestVisible = false }; var bc = new BrushConverter(); var strokeBrush = (Brush)bc.ConvertFrom("#313131"); backgroundRect.Stroke = strokeBrush; backgroundRect.StrokeThickness = 1; var backgroundBrush = new SolidColorBrush(Color.FromRgb(240, 240, 240)); backgroundRect.Fill = backgroundBrush; nodeUI.PresentationGrid.Children.Add(backgroundRect); nodeUI.PresentationGrid.Children.Add(View); nodeUI.PresentationGrid.Visibility = Visibility.Visible; DataBridge.Instance.RegisterCallback( GUID.ToString(), obj => nodeUI.Dispatcher.Invoke( new Action <object>(RenderData), DispatcherPriority.Render, obj)); }
public override void SetupCustomUIElements(dynNodeView nodeUI) { base.SetupCustomUIElements(nodeUI); var mi = new MenuItem { Header = "Show Elements" }; mi.Click += new System.Windows.RoutedEventHandler(mi_Click); nodeUI.MainContextMenu.Items.Add(mi); }
public override void SetupCustomUIElements(dynNodeView view) { //add a button to the inputGrid on the dynElement var readFileButton = new DynamoNodeButton { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, Height = Configurations.PortHeightInPixels }; readFileButton.Click += readFileButton_Click; readFileButton.Content = "Browse..."; readFileButton.HorizontalAlignment = HorizontalAlignment.Stretch; readFileButton.VerticalAlignment = VerticalAlignment.Center; var tb = new TextBox(); if (string.IsNullOrEmpty(Value)) { Value = "No file selected."; } tb.HorizontalAlignment = HorizontalAlignment.Stretch; tb.VerticalAlignment = VerticalAlignment.Center; var backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0)); tb.Background = backgroundBrush; tb.BorderThickness = new Thickness(0); tb.IsReadOnly = true; tb.IsReadOnlyCaretVisible = false; tb.TextChanged += delegate { tb.ScrollToHorizontalOffset(double.PositiveInfinity); view.ViewModel.DynamoViewModel.ReturnFocusToSearch(); }; tb.Margin = new Thickness(0, 5, 0, 5); var sp = new StackPanel(); sp.Children.Add(readFileButton); sp.Children.Add(tb); view.inputGrid.Children.Add(sp); tb.DataContext = this; var bindingVal = new Binding("Value") { Mode = BindingMode.TwoWay, Converter = new FilePathDisplayConverter() }; tb.SetBinding(TextBox.TextProperty, bindingVal); }
public override void SetupCustomUIElements(dynNodeView nodeUI) { this.dynamoViewModel = nodeUI.ViewModel.DynamoViewModel; //add a text box to the input grid of the control var rbTrue = new RadioButton(); var rbFalse = new RadioButton(); rbTrue.VerticalAlignment = VerticalAlignment.Center; rbFalse.VerticalAlignment = VerticalAlignment.Center; //use a unique name for the button group //so other instances of this element don't get confused string groupName = Guid.NewGuid().ToString(); rbTrue.GroupName = groupName; rbFalse.GroupName = groupName; rbTrue.Content = "True"; rbTrue.Padding = new Thickness(0,0,12,0); rbFalse.Content = "False"; rbFalse.Padding = new Thickness(0); var wp = new WrapPanel() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Margin = new Thickness(10,5,10,0), Orientation = Orientation.Horizontal }; wp.Children.Add(rbTrue); wp.Children.Add(rbFalse); nodeUI.inputGrid.Children.Add(wp); //rbFalse.IsChecked = true; rbTrue.Checked += OnRadioButtonClicked; rbFalse.Checked += OnRadioButtonClicked; rbFalse.DataContext = this; rbTrue.DataContext = this; var rbTrueBinding = new Binding("Value") { Mode = BindingMode.TwoWay, }; rbTrue.SetBinding(ToggleButton.IsCheckedProperty, rbTrueBinding); var rbFalseBinding = new Binding("Value") { Mode = BindingMode.TwoWay, Converter = new InverseBoolDisplay() }; rbFalse.SetBinding(ToggleButton.IsCheckedProperty, rbFalseBinding); }
public override void SetupCustomUIElements(dynNodeView view) { //add a button to the inputGrid on the dynElement var readFileButton = new DynamoNodeButton { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, Height = Configurations.PortHeightInPixels }; readFileButton.Click += readFileButton_Click; readFileButton.Content = "Browse..."; readFileButton.HorizontalAlignment = HorizontalAlignment.Stretch; readFileButton.VerticalAlignment = VerticalAlignment.Center; var tb = new TextBox(); if (string.IsNullOrEmpty(Value)) Value = "No file selected."; tb.HorizontalAlignment = HorizontalAlignment.Stretch; tb.VerticalAlignment = VerticalAlignment.Center; var backgroundBrush = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0)); tb.Background = backgroundBrush; tb.BorderThickness = new Thickness(0); tb.IsReadOnly = true; tb.IsReadOnlyCaretVisible = false; tb.TextChanged += delegate { tb.ScrollToHorizontalOffset(double.PositiveInfinity); view.ViewModel.DynamoViewModel.ReturnFocusToSearch(); }; tb.Margin = new Thickness(0,5,0,5); var sp = new StackPanel(); sp.Children.Add(readFileButton); sp.Children.Add(tb); view.inputGrid.Children.Add(sp); tb.DataContext = this; var bindingVal = new Binding("Value") { Mode = BindingMode.TwoWay, Converter = new FilePathDisplayConverter() }; tb.SetBinding(TextBox.TextProperty, bindingVal); }
public void SetupCustomUIElements(dynNodeView nodeUI) { //add a drop down list to the window var combo = new ComboBox { Width = System.Double.NaN, MinWidth = 100, Height = Configurations.PortHeightInPixels, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center }; nodeUI.inputGrid.Children.Add(combo); System.Windows.Controls.Grid.SetColumn(combo, 0); System.Windows.Controls.Grid.SetRow(combo, 0); combo.DropDownOpened += combo_DropDownOpened; combo.SelectionChanged += delegate { if (combo.SelectedIndex != -1) RequiresRecalc = true; }; combo.DropDownClosed += delegate { //disallow selection of nothing if (combo.SelectedIndex == -1) { SelectedIndex = 0; } }; combo.DataContext = this; //bind this combo box to the selected item hash var bindingVal = new System.Windows.Data.Binding("Items") { Mode = BindingMode.TwoWay, Source = this }; combo.SetBinding(ItemsControl.ItemsSourceProperty, bindingVal); //bind the selected index to the var indexBinding = new Binding("SelectedIndex") { Mode = BindingMode.TwoWay, Source = this }; combo.SetBinding(Selector.SelectedIndexProperty, indexBinding); }
public void SetupCustomUIElements(dynNodeView nodeUI) { nodeUI.MainContextMenu.Items.Add(new Separator()); // edit contents var editItem = new MenuItem { Header = "Edit Custom Node...", IsCheckable = false }; nodeUI.MainContextMenu.Items.Add(editItem); editItem.Click += (sender, args) => GoToWorkspace(nodeUI.ViewModel); // edit properties var editPropertiesItem = new MenuItem { Header = "Edit Custom Node Properties...", IsCheckable = false }; nodeUI.MainContextMenu.Items.Add(editPropertiesItem); editPropertiesItem.Click += (sender, args) => EditCustomNodeProperties(); // publish var publishCustomNodeItem = new MenuItem { Header = "Publish This Custom Node...", IsCheckable = false, IsEnabled = nodeUI.ViewModel.DynamoViewModel.PackageManagerClientViewModel.Model.HasAuthenticator }; nodeUI.MainContextMenu.Items.Add(publishCustomNodeItem); publishCustomNodeItem.Click += (sender, args) => { GoToWorkspace(nodeUI.ViewModel); if (nodeUI.ViewModel.DynamoViewModel.PublishCurrentWorkspaceCommand.CanExecute(null)) { nodeUI.ViewModel.DynamoViewModel.PublishCurrentWorkspaceCommand.Execute(null); } }; nodeUI.UpdateLayout(); }
public void SetupCustomUIElements(dynNodeView nodeUI) { var resetButt = new Button { Content = "Reset", ToolTip = "Resets the system to its initial state.", HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top }; resetButt.Click += delegate { reset = true; RequiresRecalc = true; }; nodeUI.inputGrid.Children.Add(resetButt); }
public virtual void SetupCustomUIElements(dynNodeView view) { var addButton = new DynamoNodeButton(this, "AddInPort") { Content = "+", Width = 20 }; //addButton.Height = 20; var subButton = new DynamoNodeButton(this, "RemoveInPort") { Content = "-", Width = 20 }; //subButton.Height = 20; var wp = new WrapPanel { VerticalAlignment = VerticalAlignment.Top, HorizontalAlignment = HorizontalAlignment.Center }; wp.Children.Add(addButton); wp.Children.Add(subButton); view.inputGrid.Children.Add(wp); }
public void SetupCustomUIElements(dynNodeView nodeUI) { //topControl.Height = 200; //topControl.Width = 300; //add an edit window option to the //main context window var editWindowItem = new System.Windows.Controls.MenuItem { Header = "Edit...", IsCheckable = false }; nodeUI.MainContextMenu.Items.Add(editWindowItem); editWindowItem.Click += delegate { EditScriptContent(); }; nodeUI.UpdateLayout(); nodeUI.MouseDown += nodeUI_MouseDown; }
public void SetupCustomUIElements(dynNodeView nodeUi) { image = new Image { MaxWidth = 400, MaxHeight = 400, HorizontalAlignment = System.Windows.HorizontalAlignment.Center, Name = "image1", VerticalAlignment = System.Windows.VerticalAlignment.Center }; this.PropertyChanged += (sender, args) => { if (args.PropertyName != "IsUpdated") return; var im = GetImageFromMirror(); nodeUi.Dispatcher.Invoke(new Action<Bitmap>(SetImageSource), new object[] { im }); }; nodeUi.PresentationGrid.Children.Add(image); }
public override void SetupCustomUIElements(dynNodeView NodeUI) { //widen the control NodeUI.topControl.Width = 300; //add a drop down list to the window combo = new ComboBox(); combo.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; combo.VerticalAlignment = System.Windows.VerticalAlignment.Center; NodeUI.inputGrid.Children.Add(combo); System.Windows.Controls.Grid.SetColumn(combo, 0); System.Windows.Controls.Grid.SetRow(combo, 0); combo.SelectionChanged += delegate { if (combo.SelectedIndex != -1) this.RequiresRecalc = true; }; }
public override void SetupCustomUIElements(dynNodeView nodeUI) { //add a button to the inputGrid on the dynElement var selectButton = new dynNodeButton { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center }; selectButton.Click += selectButton_Click; nodeUI.inputGrid.RowDefinitions.Add(new RowDefinition()); nodeUI.inputGrid.Children.Add(selectButton); Grid.SetRow(selectButton, 0); selectButton.DataContext = this; var buttonEnabledBinding = new Binding("CanSelect") { Mode = BindingMode.TwoWay }; selectButton.SetBinding(UIElement.IsEnabledProperty, buttonEnabledBinding); }
public void SetupCustomUIElements(dynNodeView view) { var tb = new DynamoTextBox(FormulaString) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Top, Background = new SolidColorBrush(Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF)) }; view.inputGrid.Children.Add(tb); Grid.SetColumn(tb, 0); Grid.SetRow(tb, 0); tb.DataContext = this; tb.BindToProperty(new Binding("FormulaString") { Mode = BindingMode.TwoWay, NotifyOnValidationError = false, Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }); }
public void SetupCustomUIElements(dynNodeView nodeUI) { var mi = new MenuItem { Header = "Zoom to Fit" }; mi.Click += mi_Click; nodeUI.MainContextMenu.Items.Add(mi); //add a 3D viewport to the input grid //http://helixtoolkit.codeplex.com/wikipage?title=HelixViewport3D&referringTitle=Documentation //_watchView = new WatchView(); View = new Watch3DView(GUID.ToString()) { DataContext = this, Width = _watchWidth, Height = _watchHeight }; View.View.Camera.Position = _camPosition; View.View.Camera.LookDirection = _lookDirection; var backgroundRect = new Rectangle { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, IsHitTestVisible = false }; var bc = new BrushConverter(); var strokeBrush = (Brush)bc.ConvertFrom("#313131"); backgroundRect.Stroke = strokeBrush; backgroundRect.StrokeThickness = 1; var backgroundBrush = new SolidColorBrush(Color.FromRgb(240, 240, 240)); backgroundRect.Fill = backgroundBrush; nodeUI.PresentationGrid.Children.Add(backgroundRect); nodeUI.PresentationGrid.Children.Add(View); nodeUI.PresentationGrid.Visibility = Visibility.Visible; }
public override void SetupCustomUIElements(dynNodeView nodeUI) { nodeUI.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(ui_MouseDoubleClick); }
private bool CanSetupCustomUIElements(dynNodeView NodeUI) { return true; }
private void SetupCustomUIElements(dynNodeView NodeUI) { nodeLogic.SetupCustomUIElements(NodeUI); }
public override void SetupCustomUIElements(dynNodeView NodeUI) { //add an edit window option to the //main context window var editWindowItem = new System.Windows.Controls.MenuItem(); editWindowItem.Header = "Edit..."; editWindowItem.IsCheckable = false; NodeUI.MainContextMenu.Items.Add(editWindowItem); editWindowItem.Click += new RoutedEventHandler(editWindowItem_Click); //add a text box to the input grid of the control var tb = new dynTextBox(); tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; tb.VerticalAlignment = System.Windows.VerticalAlignment.Center; NodeUI.inputGrid.Children.Add(tb); System.Windows.Controls.Grid.SetColumn(tb, 0); System.Windows.Controls.Grid.SetRow(tb, 0); tb.IsNumeric = false; tb.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF)); tb.DataContext = this; var bindingVal = new System.Windows.Data.Binding("Measure.Item.Length") { Mode = BindingMode.TwoWay, Converter = new RevitProjectUnitsConverter(), ConverterParameter = Measure, NotifyOnValidationError = false, Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }; tb.SetBinding(System.Windows.Controls.TextBox.TextProperty, bindingVal); tb.Text = "0.0"; }
public void SetupCustomUIElements(dynNodeView nodeUI) { base.InitializeUI(nodeUI); var drawPlane = new Image { Stretch = Stretch.Fill, HorizontalAlignment = HorizontalAlignment.Stretch, Width = 100, Height = 200 }; nodeUI.inputGrid.Children.Add(drawPlane); RequestChangeColorRange += delegate { DispatchOnUIThread(delegate { WriteableBitmap bmp = CompleteColorScale(_start, _end); drawPlane.Source = bmp; }); }; }
public virtual void SetupCustomUIElements(dynNodeView view) { VariableInputController.SetupNodeUI(view); }
public abstract void SetupCustomUIElements(dynNodeView view);
public override void SetupCustomUIElements(dynNodeView nodeUI) { //add a button to the inputGrid on the dynElement var selectButton = new DynamoNodeButton() { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center }; selectButton.Click += selectButton_Click; var tb = new TextBox { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(0, 0, 0, 0)), BorderThickness = new Thickness(0), IsReadOnly = true, IsReadOnlyCaretVisible = false, MaxWidth = 200, TextWrapping = TextWrapping.Wrap }; nodeUI.inputGrid.RowDefinitions.Add(new RowDefinition()); nodeUI.inputGrid.RowDefinitions.Add(new RowDefinition()); nodeUI.inputGrid.Children.Add(tb); nodeUI.inputGrid.Children.Add(selectButton); System.Windows.Controls.Grid.SetRow(selectButton, 0); System.Windows.Controls.Grid.SetRow(tb, 1); tb.DataContext = this; selectButton.DataContext = this; var selectTextBinding = new System.Windows.Data.Binding("SelectionText") { Mode = BindingMode.TwoWay, }; tb.SetBinding(TextBox.TextProperty, selectTextBinding); var buttonTextBinding = new System.Windows.Data.Binding("SelectedElement") { Mode = BindingMode.OneWay, Converter = new SelectionButtonContentConverter(), }; selectButton.SetBinding(ContentControl.ContentProperty, buttonTextBinding); var buttonEnabledBinding = new System.Windows.Data.Binding("CanSelect") { Mode = BindingMode.TwoWay, }; selectButton.SetBinding(Button.IsEnabledProperty, buttonEnabledBinding); }
/// <summary> /// UI is initialized and bindings are setup here. /// </summary> /// <param name="nodeUI">UI view that we can customize the UI of.</param> public override void SetupCustomUIElements(dynNodeView nodeUI) { //add a slider control to the input grid of the control var tbSlider = new DynamoSlider(this) { HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Center, MinWidth = 150, TickPlacement = TickPlacement.None, Value = Value }; tbSlider.PreviewMouseUp += delegate { dynSettings.ReturnFocusToSearch(); }; var mintb = new DynamoTextBox { Width = Configurations.DoubleSliderTextBoxWidth, HorizontalContentAlignment = HorizontalAlignment.Center, Background = new SolidColorBrush(Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF)) }; // input value textbox var valtb = new DynamoTextBox(SerializeValue()) { Width = Configurations.DoubleSliderTextBoxWidth, HorizontalContentAlignment = HorizontalAlignment.Center, Margin = new Thickness(0, 0, 10, 0) }; var maxtb = new DynamoTextBox { Width = Configurations.DoubleSliderTextBoxWidth, HorizontalContentAlignment = HorizontalAlignment.Center, Background = new SolidColorBrush(Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF)) }; var sliderGrid = new Grid(); sliderGrid.ColumnDefinitions.Add( new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); sliderGrid.ColumnDefinitions.Add( new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); sliderGrid.ColumnDefinitions.Add( new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); sliderGrid.ColumnDefinitions.Add( new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) }); sliderGrid.Children.Add(valtb); sliderGrid.Children.Add(mintb); sliderGrid.Children.Add(tbSlider); sliderGrid.Children.Add(maxtb); Grid.SetColumn(valtb, 0); Grid.SetColumn(mintb, 1); Grid.SetColumn(tbSlider, 2); Grid.SetColumn(maxtb, 3); nodeUI.inputGrid.Children.Add(sliderGrid); maxtb.DataContext = this; tbSlider.DataContext = this; mintb.DataContext = this; valtb.DataContext = this; // value input valtb.BindToProperty( new Binding("Value") { Mode = BindingMode.TwoWay, Converter = new DoubleDisplay() }); // slider value var sliderBinding = new Binding("Value") { Mode = BindingMode.TwoWay, Source = this, }; tbSlider.SetBinding(RangeBase.ValueProperty, sliderBinding); // max value maxtb.BindToProperty( new Binding("Max") { Mode = BindingMode.TwoWay, Converter = new DoubleDisplay(), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }); // max slider value var bindingMaxSlider = new Binding("Max") { Mode = BindingMode.OneWay, Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }; tbSlider.SetBinding(RangeBase.MaximumProperty, bindingMaxSlider); // min value mintb.BindToProperty( new Binding("Min") { Mode = BindingMode.TwoWay, Converter = new DoubleDisplay(), Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }); // min slider value var bindingMinSlider = new Binding("Min") { Mode = BindingMode.OneWay, Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }; tbSlider.SetBinding(RangeBase.MinimumProperty, bindingMinSlider); }
/// <summary> /// Called back from the view to enable users to setup their own view elements /// </summary> /// <param name="parameter"></param> public virtual void SetupCustomUIElements(dynNodeView nodeUI) { }
public override void SetupCustomUIElements(dynNodeView nodeUI) { var tb = new dynTextBox(); tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; tb.VerticalAlignment = System.Windows.VerticalAlignment.Top; nodeUI.inputGrid.Children.Add(tb); System.Windows.Controls.Grid.SetColumn(tb, 0); System.Windows.Controls.Grid.SetRow(tb, 0); tb.IsNumeric = false; tb.Background = new SolidColorBrush(Color.FromArgb(0x88, 0xFF, 0xFF, 0xFF)); tb.DataContext = this; var bindingVal = new Binding("Formula") { Mode = BindingMode.TwoWay, NotifyOnValidationError = false, Source = this, UpdateSourceTrigger = UpdateSourceTrigger.Explicit }; tb.SetBinding(TextBox.TextProperty, bindingVal); }