public void CustomizeView(StringInput stringInput, NodeView nodeView)
        {
            this.nodeModel       = stringInput;
            this.dynamoViewModel = nodeView.ViewModel.DynamoViewModel;

            this.editWindowItem = new MenuItem {
                Header = "Edit...", IsCheckable = false
            };
            nodeView.MainContextMenu.Items.Add(editWindowItem);

            editWindowItem.Click += editWindowItem_Click;

            //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
            };

            nodeView.inputGrid.Children.Add(tb);
            Grid.SetColumn(tb, 0);
            Grid.SetRow(tb, 0);

            tb.DataContext = stringInput;
            tb.BindToProperty(new Binding("Value")
            {
                Mode                = BindingMode.TwoWay,
                Converter           = new StringDisplay(),
                Source              = stringInput,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });
        }
        public void CustomizeView(UnitInput stringInput, NodeView nodeView)
        {
            this.nodeModel       = stringInput;
            this.dynamoViewModel = nodeView.ViewModel.DynamoViewModel;

            this.editWindowItem = new MenuItem
            {
                Header      = Dynamo.Wpf.Properties.Resources.StringInputNodeEditMenu,
                IsCheckable = false
            };
            nodeView.MainContextMenu.Items.Add(editWindowItem);

            editWindowItem.Click += editWindowItem_Click;

            var grid = new Grid()
            {
                Height = Double.NaN,
                Width  = Double.NaN
            };

            RowDefinition rowDef1 = new RowDefinition();
            RowDefinition rowDef2 = new RowDefinition();

            grid.RowDefinitions.Add(rowDef1);
            grid.RowDefinitions.Add(rowDef2);

            //add a text box to the input grid of the control
            var tb = new StringTextBox
            {
                TextWrapping      = TextWrapping.Wrap,
                MinHeight         = Configurations.PortHeightInPixels,
                MinWidth          = 200,
                MaxWidth          = 300,
                VerticalAlignment = VerticalAlignment.Stretch
            };

            grid.Children.Add(tb);

            Grid.SetColumn(tb, 0);
            Grid.SetRow(tb, 0);

            tb.DataContext = stringInput;
            tb.BindToProperty(new Binding("Value")
            {
                Mode                = BindingMode.TwoWay,
                Converter           = new StringDisplay(),
                Source              = stringInput,
                UpdateSourceTrigger = UpdateSourceTrigger.Explicit
            });

            //add a drop down list to the window
            var combo = new ComboBox
            {
                Width               = System.Double.NaN,
                MinWidth            = 200,
                MaxWidth            = 300,
                Height              = Configurations.PortHeightInPixels,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Center,
                Margin              = new Thickness(0, 3, 0, 0)
            };

            var dataTemplate = new DataTemplate();
            var fef          = new FrameworkElementFactory(typeof(TextBlock));

            fef.SetBinding(TextBlock.TextProperty, new Binding()
            {
                Converter = new ForgeUnitToTextConverter()
            });

            dataTemplate.DataType   = (typeof(TextBlock));
            dataTemplate.VisualTree = fef;

            combo.ItemTemplate = dataTemplate;
            combo.Style        = (Style)SharedDictionaryManager.DynamoModernDictionary["RefreshComboBox"];

            grid.Children.Add(combo);
            Grid.SetColumn(combo, 0);
            Grid.SetRow(combo, 1);

            combo.SelectionChanged += delegate
            {
                if (combo.SelectedIndex != -1)
                {
                    nodeModel.OnNodeModified();
                }
            };

            combo.DataContext = nodeModel;

            // bind this combo box to the selected item hash
            var bindingVal = new System.Windows.Data.Binding("Items")
            {
                Source = nodeModel
            };

            combo.SetBinding(ItemsControl.ItemsSourceProperty, bindingVal);

            // bind the selected index to the model property SelectedIndex
            var indexBinding = new Binding("SelectedUnit")
            {
                Mode   = BindingMode.TwoWay,
                Source = nodeModel
            };

            combo.SetBinding(Selector.SelectedItemProperty, indexBinding);

            nodeView.inputGrid.Children.Add(grid);
        }