private void chainInit() { font = new FontRTB(true, false, false, fontSingleton.font); boldChangeHandler = new BoldChangeHandler(); italicsChangeHandler = new ItalicsChangeHandler(); underlineChangeHandler = new UnderlineChangeHandler(); boldChangeHandler.Successor = italicsChangeHandler; italicsChangeHandler.Successor = underlineChangeHandler; }
public ItemSelector(object commonRecords, Type modelType) { InitializeComponent(); ml = (HeadList)commonRecords; TextChanged += new TextChangeHandler((object sender) => { //Prevent forcing changes to other instances of the user control if (this == ((ItemSelector)sender)) { // this.textBox1.Text = string.Empty + this.SelectedId.ID; // this.textBox2.Text = string.Empty + this.SelectedId.ID; // this.comboBox1.SelectedItem = this.SelectedId; } }); this.textBox1.TextChanged +=new TextChangedEventHandler(textBox1_TextChanged); //new EditValueChangedEventHandler((object sender, EditValueChangedEventArgs e) => //{ // this.Text = textBox1.Text; //}); Binding binding = new Binding(); //Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Controls:MyUserControl}},Path=MainMenuImageSource //binding.RelativeSource = new RelativeSource(); //binding.RelativeSource.Mode = RelativeSourceMode.FindAncestor; //binding.RelativeSource.AncestorType = new //binding.RelativeSource.Mode = RelativeSourceMode.FindAncestor; /*binding.ElementName = "dataGrid1"; binding.Path = new PropertyPath("SelectedItem.Name"); binding.Mode = BindingMode.TwoWay; binding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged; textBox1.SetBinding(TextBox.TextProperty, binding); * */ // comboBox1.SelectedValuePath = "Head.Name"; //comboBox1.SelectedItem = "Head.Name"; //comboBox1.Name="combo";Binding Path=SelectedItem.Company, //ElementName=lstPersons, Mode=Default comboBox1.ItemsSource = ml; comboBox1.DisplayMemberPath="Name"; comboBox1.SelectedValuePath="ID"; Binding binding2 = new Binding("ID"); ///binding.ElementName = "textBox1"; binding2.Mode = BindingMode.TwoWay; comboBox1.SelectedValue = binding2; Binding binding3 = new Binding(); //comboBox1.SelectedValue = binding3; BindingExpression be = textBox1.GetBindingExpression(TextBox.TextProperty); }
public SearchControl() { InitializeComponent(); //this.DataContext = this; TextChanged += new TextChangeHandler((object sender) => { //Prevent forcing changes to other instances of the user control if (this == ((SearchControl)sender)) { this.txtSearch.Text = this.ControlText; } }); this.txtSearch.TextChanged += new TextChangedEventHandler((object sender, TextChangedEventArgs e) => { this.ControlText = txtSearch.Text; }); }
/// <summary> /// Handles a double click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void watchDataGridView_DoubleClick(object sender, EventArgs e) { try { HandlingDoubleClick = true; List <WatchedExpression> watches = (List <WatchedExpression>)watchDataGridView.DataSource; // Open a editor to edit the cell contents WatchedExpression selected = SelectedWatch; if (selected != null) { DataGridViewCell selectedCell = watchDataGridView.SelectedCells[0]; if (selectedCell.ColumnIndex == 0) { EditorView.Window form = new EditorView.Window { AutoComplete = true }; TextChangeHandler handler = new TextChangeHandler(Instance, selected, selectedCell.OwningColumn.Name); form.setChangeHandler(handler); form.ShowDialog(); watchDataGridView.DataSource = null; watchDataGridView.DataSource = watches; EnsureEmptyRoom(); Refresh(); } else if (selectedCell.ColumnIndex == 1) { ExplainBox explainTextBox = new ExplainBox(); explainTextBox.SetExplanation(selected.ExpressionTree.Explain()); GuiUtils.MdiWindow.AddChildWindow(explainTextBox); } } } finally { HandlingDoubleClick = false; } }
/// <summary> /// Handles a double click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void watchDataGridView_DoubleClick(object sender, EventArgs e) { try { HandlingDoubleClick = true; List<WatchedExpression> watches = (List<WatchedExpression>) watchDataGridView.DataSource; // Open a editor to edit the cell contents WatchedExpression selected = SelectedWatch; if (selected != null) { DataGridViewCell selectedCell = watchDataGridView.SelectedCells[0]; if (selectedCell.ColumnIndex == 0) { EditorView.Window form = new EditorView.Window {AutoComplete = true}; TextChangeHandler handler = new TextChangeHandler(Instance, selected, selectedCell.OwningColumn.Name); form.setChangeHandler(handler); form.ShowDialog(); watchDataGridView.DataSource = null; watchDataGridView.DataSource = watches; EnsureEmptyRoom(); Refresh(); } else if (selectedCell.ColumnIndex == 1) { ExplainBox explainTextBox = new ExplainBox(); explainTextBox.SetExplanation(selected.ExpressionTree.Explain()); GuiUtils.MdiWindow.AddChildWindow(explainTextBox); } } } finally { HandlingDoubleClick = false; } }
private void OnTextChanged(object sender, EventArgs e) { ChangedSinceSave = true; TextChangeHandler?.Invoke(this, e); }