public LibraryWindow() { InitializeComponent(); this._sliderChangedHandler = new RoutedPropertyChangedEventHandler<double>(this.RankSlider_ValueChanged); this.LoadBlankPuzzle(3); this.PuzzleListBox.Items.Clear(); this.PuzzleListBox.ItemsSource = Global.Data.Library.Puzzles; this.RankSlider.ValueChanged += this._sliderChangedHandler; }
private void LoadSlider(float setvalue, float multiply, Slider slider, RoutedPropertyChangedEventHandler <double> valueChanged) { IsSliderSetting = true; var min = (int)slider.Minimum; var max = (int)slider.Maximum; int value = (int)Math.Round(setvalue * multiply); if (value < min) { value = min; } if (value > max) { value = max; } slider.Value = value; IsSliderSetting = false; }
private static void OnCommandChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dpceArgs) { string eventName = GetEvent(dependencyObject); var clickEvent = dependencyObject.GetType().GetEvents().FirstOrDefault(eventInfo => eventInfo.Name.Equals(eventName)); if (clickEvent != null) { string parameter = dependencyObject.GetValue(_commandProperty).ToString(); ICommand command = (ICommand)dpceArgs.NewValue; bool useParameter = GetUseParameter(dependencyObject); if (clickEvent.EventHandlerType.Equals(typeof(RoutedEventHandler)) == true) { RoutedEventHandler handler = null; if (useParameter == false) { handler = delegate(object sender, RoutedEventArgs arg) { command.Execute(parameter); }; } else { handler = delegate(object sender, RoutedEventArgs arg) { command.Execute(arg); }; } clickEvent.AddEventHandler((object)dependencyObject, handler); } else if (clickEvent.EventHandlerType.Equals(typeof(RoutedPropertyChangedEventHandler <double>)) == true) { RoutedPropertyChangedEventHandler <double> handler = null; if (useParameter == false) { handler = delegate(object sender, RoutedPropertyChangedEventArgs <double> arg) { command.Execute(parameter); }; } else { handler = delegate(object sender, RoutedPropertyChangedEventArgs <double> arg) { command.Execute(arg); }; } clickEvent.AddEventHandler((object)dependencyObject, handler); } } }
public void ExpectEventHandlers() { var c = new Canvas(); bool eventWasRaised; RoutedPropertyChangedEventHandler <bool> handler = (s, e) => { Assert.AreSame(c, s); eventWasRaised = true; }; c.AddHandler(GridSnap.IsEnabledChangedEvent, handler); { eventWasRaised = false; GridSnap.SetIsEnabled(c, true); Assert.IsTrue(eventWasRaised); } }
/// <summary> /// Raises the IsOpenChanged event. /// </summary> /// <param name="args">Arguments associated with the IsOpenChanged event.</param> protected virtual void OnIsOpenChanged(RoutedPropertyChangedEventArgs <bool> args) { if (args.NewValue && this._container == null) { if (KeysOpened == null) { throw new ArgumentNullException(); } this.StartIntellisense(); _insertStart = this.AssociatedObject.CaretPosition; // IMPORTANT: This is needed for when the rightclick menue is used: // Because the TextPointer remembers the position by selecting a character and then if the insert-postion was before or after the character we need to be carefull. // Example: text is "12" // I want to select between 1 and 2 but that can have two outcomes // If i click to the left side (more on the 1) then i get the TextPointer with properties 1 and formward-direction // If i click to the right side (more on the 2) then i get the TextPointer with properties 2 and backward-direction // The problem is then when we get a TextPointer with properties 2 and backward because now when new charachters are typed it will move with the new text and when a TextRange is created with that it will always be empty if (_insertStart.LogicalDirection == LogicalDirection.Forward) { _insertStart = this.AssociatedObject.CaretPosition.GetPositionAtOffset(-1); } _insertEnd = this.AssociatedObject.CaretPosition; this.CoreIntellisense(); } if (!args.NewValue) { this._container.IsOpen = false; this._container = null; } RoutedPropertyChangedEventHandler <bool> handler = IsOpenChanged; if (handler != null) { handler(this, args); } RoutedPropertyChangedEventHandler <bool> previewHandler = PreviewIsOpenChanged; if (previewHandler != null) { previewHandler(this, args); } }
/// <summary> /// Called when the value of the OffsetRatioProperty property changes. /// </summary> /// <param name="oldValue">The value to be replaced.</param> /// <param name="newValue">The new value.</param> private void OnOffsetRatioPropertyChanged(double oldValue, double newValue) { if (ValueHelper.CanGraph(newValue)) { RoutedPropertyChangedEventHandler <double> handler = this.OffsetRatioChanged; if (handler != null) { handler(this, new RoutedPropertyChangedEventArgs <double>(oldValue, newValue)); } if (this.State == DataPointState.Created) { ActualOffsetRatio = newValue; } } else { this.OffsetRatio = 0.0; } }
/// <summary> /// Called when the value of the ActualRatioProperty property changes. /// </summary> /// <param name="oldValue">The value to be replaced.</param> /// <param name="newValue">The new value.</param> private void OnActualRatioPropertyChanged(double oldValue, double newValue) { if (ValueHelper.CanGraph(newValue)) { RoutedPropertyChangedEventHandler <double> handler = this.ActualRatioChanged; if (handler != null) { handler(this, new RoutedPropertyChangedEventArgs <double>(oldValue, newValue)); } } else { this.ActualRatio = 0.0; } if (DesignerProperties.GetIsInDesignMode(this)) { PieSeries.UpdatePieDataPointGeometry(this, ActualWidth, ActualHeight); } }
public MainWindowModelView() { //initialization this.Messages = new ObservableCollection <string>(); SPDataModel = null; //commands this.ImportDataModel = new ImportDataModelCommandImplementation(this); this.SaveDataModel = new SaveSPDataModelCommand(this); this.SaveSQLScript = new SaveSQLScriptCommand(this); this.SaveDropTableSQLScript = new SaveDropTableSQLScriptCommand(this); //event handlers TreeViewExpanded = new RoutedEventHandler(TreeViewExpandedHandler); TreeViewSelectedItemChanged = new RoutedPropertyChangedEventHandler <Object>(TreeViewSelectedItemChangedHandler); //Get default values from the Properties.Settings b_URL = Properties.Settings.Default.URL; b_InludeHidden = Properties.Settings.Default.InludeHidden; b_GroupName = Properties.Settings.Default.GroupName; b_DatabaseName = Properties.Settings.Default.DatabaseName; b_FileName = Properties.Settings.Default.FileName; }
/// <summary> /// Called when the value of the RatioProperty property changes. /// </summary> /// <param name="oldValue">The value to be replaced.</param> /// <param name="newValue">The new value.</param> private void OnRatioPropertyChanged(double oldValue, double newValue) { if (ValueHelper.CanGraph(newValue)) { SetFormattedProperty(FormattedRatioProperty, RatioStringFormat, newValue); RoutedPropertyChangedEventHandler <double> handler = this.RatioChanged; if (handler != null) { handler(this, new RoutedPropertyChangedEventArgs <double>(oldValue, newValue)); } if (this.State == DataPointState.Created) { ActualRatio = newValue; } } else { this.Ratio = 0.0; } }
public override void attachEventHandler(string name, Action <string> action) { FrameworkElement element = getElementByName(name); switch (element.GetType().ToString()) { case "System.Windows.Controls.TextBox": TextChangedEventHandler eventHandler = (a, b) => { action(name); }; ((TextBox)element).TextChanged += eventHandler; break; case "System.Windows.Controls.CheckBox": RoutedEventHandler eventHandler2 = (a, b) => { action(name); }; ((CheckBox)element).Checked += eventHandler2; ((CheckBox)element).Unchecked += eventHandler2; break; case "System.Windows.Controls.Slider": RoutedPropertyChangedEventHandler <double> eventHandler3 = (a, b) => { action(name); }; ((Slider)element).ValueChanged += eventHandler3; break; case "System.Windows.Controls.RadioButton": RoutedEventHandler eventHandler4 = (a, b) => { action(name); }; ((RadioButton)element).Checked += eventHandler4; ((RadioButton)element).Unchecked += eventHandler4; break; case "System.Windows.Controls.ListBoxItem": case "System.Windows.Controls.ComboBoxItem": RoutedEventHandler eventHandler5 = (a, b) => { action(name); }; ((ListBoxItem)element).Selected += eventHandler5; ((ListBoxItem)element).Unselected += eventHandler5; break; default: throw new Exception("attachEventHandler not supported for " + element.GetType().ToString()); break; } }
/*------------ Generate Color Picker For Each Department ------------*/ public static void GenerateColorPicker(Grid grid, string name, byte[] color, RoutedPropertyChangedEventHandler <Color?> Color_Changed) { int rowIndex = grid.RowDefinitions.Count; // Add Row For Each Program RowDefinition gridRow = new RowDefinition(); gridRow.Height = new GridLength(40); grid.RowDefinitions.Add(gridRow); // Generate And Display Label Of Each Department Label departmentName = new Label(); departmentName.Content = name; departmentName.Height = 30; departmentName.FontSize = 14; departmentName.BorderBrush = Brushes.Black; departmentName.BorderThickness = new Thickness(0.3); departmentName.FontWeight = FontWeights.DemiBold; departmentName.HorizontalContentAlignment = HorizontalAlignment.Left; departmentName.VerticalContentAlignment = VerticalAlignment.Center; departmentName.HorizontalAlignment = HorizontalAlignment.Stretch; departmentName.VerticalAlignment = VerticalAlignment.Center; Grid.SetColumn(departmentName, 0); Grid.SetRow(departmentName, rowIndex); grid.Children.Add(departmentName); // Generate And Display ColorPicker Of Each Department ColorPicker colorPicker = new ColorPicker(); colorPicker.SelectedColor = Color.FromRgb(color[0], color[1], color[2]); colorPicker.Height = 30; colorPicker.HorizontalAlignment = HorizontalAlignment.Stretch; colorPicker.VerticalAlignment = VerticalAlignment.Center; Grid.SetColumn(colorPicker, 1); Grid.SetRow(colorPicker, rowIndex); grid.Children.Add(colorPicker); colorPicker.SelectedColorChanged += Color_Changed; }
internal virtual void OnValueChanged(double oldValue, double newValue) { if (newValue.Equals(oldValue)) { return; } if (newValue > this.Maximum) { this.Value = this.Maximum; } if (newValue < this.Minimum) { this.Value = this.Minimum; } RoutedPropertyChangedEventHandler <double> routedPropertyChangedEventHandler = this.ValueChanged; if (routedPropertyChangedEventHandler != null) { routedPropertyChangedEventHandler(this, new RoutedPropertyChangedEventArgs <double>(oldValue, newValue)); } }
protected override void CreatePotenzielleZiele(Schiffsposition von, object argument, Action<Schiffsposition> enable) { _Angle = von.OrientationAngle; _Position = von.Position.AsVector(); _Gradeaus = _Angle.AsVector(); _Links = (_Angle - 90).AsVector(); _Rechts = (_Angle + 90).AsVector(); enable(_Links3 = SchiffspositionFabrik.Neu( position: _Position + (_Gradeaus * 240) + (_Links * 240), orientation: _Angle - 180, color: von.ViewModel.Color, opacity: 0.4, label: "3")); enable(_Rechts3 = SchiffspositionFabrik.Neu( position: _Position + (_Gradeaus * 240) + (_Rechts * 240), orientation: _Angle + 180, color: von.ViewModel.Color, opacity: 0.4, label: "3")); _Fluglinien.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 43,0 A 196,196 0 0 0 -154,-197") }); _Fluglinien.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 43,0 A 196,196 0 0 1 240,-197") }); _Fluglinien.ForEach(fl => von.Canvas.Children.Add(fl)); von.ViewModel.Slider1Visible = true; von.Slider1.Value = 0; von.Slider1.ValueChanged += slider1ValueChanged = new RoutedPropertyChangedEventHandler<double>((object o, RoutedPropertyChangedEventArgs<double> e) => { var targetSlide = e.NewValue * 2.2; _Links3.PositionAt(_Position + (_Gradeaus * 240) + (_Links * 240) + (_Gradeaus * targetSlide)); _Rechts3.PositionAt(_Position + (_Gradeaus * 240) + (_Rechts * 240) + (_Gradeaus * targetSlide * -1)); }); }
private void SetSliderValues( Slider slider, RoutedPropertyChangedEventHandler <double> handler, double value, double?minimum, double?maximum) { if (slider != null) { slider.ValueChanged -= handler; slider.Value = value; if (minimum != null) { slider.Minimum = minimum.Value; } if (maximum != null) { slider.Maximum = maximum.Value; } slider.ValueChanged += handler; } }
public UiEncodingLabeledNumber(string label, int width, int minValue, int maxValue, RoutedPropertyChangedEventHandler<object> onValueChanged) { _onValueChanged = onValueChanged; ColumnDefinitions.Add(new ColumnDefinition() {Width = GridLength.Auto}); ColumnDefinitions.Add(new ColumnDefinition()); Margin = new Thickness(5); UiTextBlock labelControl = UiTextBlockFactory.Create(label); { labelControl.Margin = new Thickness(5, 5, 2, 5); labelControl.VerticalAlignment = VerticalAlignment.Center; AddUiElement(labelControl, 0, 0); } NumberControl = UiIntegerUpDownFactory.Create(minValue, maxValue); { NumberControl.Width = width; NumberControl.Margin = new Thickness(2, 5, 5, 5); NumberControl.ValueChanged += OnValueChanged; AddUiElement(NumberControl, 0, 1); } }
public static void RemovePageFilterChangedHandler(FrameworkElement dobj, RoutedPropertyChangedEventHandler <Page> handler) => dobj.RemoveHandler(PageFilterChangedEvent, handler);
protected override void CreatePotenzielleZiele(Schiffsposition von, object argument, Action<Schiffsposition> enable) { _Angle = von.OrientationAngle; _Position = von.Position.AsVector(); _Gradeaus = _Angle.AsVector(); _Nachhinten = (_Angle + 180).AsVector(); _Links = (_Angle - 90).AsVector(); _Rechts = (_Angle + 90).AsVector(); enable(_Links1 = SchiffspositionFabrik.Neu( position: _Position + (_Links * 172), orientation: _Angle, color: von.ViewModel.Color, opacity: 0.4, label: "1")); enable(_Links1SchrägVorwärtz = SchiffspositionFabrik.Neu( position: _Position + (_Links * 202) + (_Gradeaus * 82), orientation: _Angle + 45, color: von.ViewModel.Color, opacity: 0.4, label: "1")); enable(_Links1SchrägRückwärtz = SchiffspositionFabrik.Neu( position: _Position + (_Links * 202) + (_Nachhinten * 82), orientation: _Angle - 45, color: von.ViewModel.Color, opacity: 0.4, label: "1")); enable(_Links2 = SchiffspositionFabrik.Neu( position: _Position + (_Links * 259), orientation: _Angle, color: von.ViewModel.Color, opacity: 0.4, label: "2")); enable(_Links2SchrägVorwärtz = SchiffspositionFabrik.Neu( position: _Position + (_Links * 275) + (_Gradeaus * 119), orientation: _Angle + 45, color: von.ViewModel.Color, opacity: 0.4, label: "2")); enable(_Links2SchrägRückwärtz = SchiffspositionFabrik.Neu( position: _Position + (_Links * 275) + (_Nachhinten * 119), orientation: _Angle - 45, color: von.ViewModel.Color, opacity: 0.4, label: "2")); enable(_Rechts1 = SchiffspositionFabrik.Neu( position: _Position + (_Rechts * 172), orientation: _Angle, color: von.ViewModel.Color, opacity: 0.4, label: "1")); enable(_Rechts1SchrägVorwärtz = SchiffspositionFabrik.Neu( position: _Position + (_Rechts * 202) + (_Gradeaus * 82), orientation: _Angle - 45, color: von.ViewModel.Color, opacity: 0.4, label: "1")); enable(_Rechts1SchrägRückwärtz = SchiffspositionFabrik.Neu( position: _Position + (_Rechts * 202) + (_Nachhinten * 82), orientation: _Angle + 45, color: von.ViewModel.Color, opacity: 0.4, label: "1")); enable(_Rechts2 = SchiffspositionFabrik.Neu( position: _Position + (_Rechts * 259), orientation: _Angle, color: von.ViewModel.Color, opacity: 0.4, label: "2")); enable(_Rechts2SchrägVorwärtz = SchiffspositionFabrik.Neu( position: _Position + (_Rechts * 275) + (_Gradeaus * 119), orientation: _Angle - 45, color: von.ViewModel.Color, opacity: 0.4, label: "2")); enable(_Rechts2SchrägRückwärtz = SchiffspositionFabrik.Neu( position: _Position + (_Rechts * 275) + (_Nachhinten * 119), orientation: _Angle + 45, color: von.ViewModel.Color, opacity: 0.4, label: "2")); _FluglinienLinks.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 0,43 L -172,43") }); _FluglinienLinks.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 0,43 A 168,168 0 0 1 -131,-6") }); _FluglinienLinks.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 0,43 A 168,168 0 0 0 -131,92") }); _FluglinienLinks.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 0,43 A 300,300 0 0 1 -201,-46") }); _FluglinienLinks.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 0,43 A 300,300 0 0 0 -201,132") }); _FluglinienLinks.ForEach(fl => von.Canvas.Children.Add(fl)); _FluglinienRechts.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 86,43 L 258,43") }); _FluglinienRechts.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 86,43 A 168,168 0 0 0 217,-6") }); _FluglinienRechts.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 86,43 A 168,168 0 0 1 217,92") }); _FluglinienRechts.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 86,43 A 300,300 0 0 0 287,-46") }); _FluglinienRechts.Add(new Path { Opacity = 0.2, Stroke = Brushes.White, StrokeThickness = 43, Data = Geometry.Parse("M 86,43 A 300,300 0 0 1 287,132") }); _FluglinienRechts.ForEach(fl => von.Canvas.Children.Add(fl)); von.ViewModel.Slider1Visible = true; von.Slider1.Value = 0; von.Slider1.ValueChanged += slider1ValueChanged = new RoutedPropertyChangedEventHandler<double>((object o, RoutedPropertyChangedEventArgs<double> e) => { Slide(von.Slider1.Value, von.Slider2.Value); }); von.ViewModel.Slider2Visible = true; von.Slider2.Value = 0; von.Slider2.ValueChanged += slider2ValueChanged = new RoutedPropertyChangedEventHandler<double>((object o, RoutedPropertyChangedEventArgs<double> e) => { Slide(von.Slider1.Value, von.Slider2.Value); }); }
void Fun() { var del = new RoutedPropertyChangedEventHandler <double> (Test); del(null, null); }
public ExtendedTreeView() : base() { SelectedItemChanged += new RoutedPropertyChangedEventHandler <object>(___ICH); }
/// <summary> /// This is used to bind the controls in the given collection to their associated project properties /// </summary> /// <param name="controls">The control collection from which to get the bound controls. WPF controls and /// their children in an <see cref="ElementHost"/> are bound if they declare a property name using the /// <see cref="P:SandcastleBuilder.WPF.PropertyPages.PropertyPageBinding.ProjectPropertyName"/> attached /// property.</param> protected void BindProperties(System.Windows.Forms.Control.ControlCollection controls) { Type t; PropertyInfo pi; string typeName, boundProperty; try { this.IsBinding = true; foreach (var control in controls.OfType <ElementHost>().Select(h => (FrameworkElement)h.Child)) { foreach (var c in control.AllChildElements().Where(c => !String.IsNullOrWhiteSpace(PropertyPageBinding.GetProjectPropertyName(c)))) { t = c.GetType(); typeName = t.FullName; boundProperty = PropertyPageBinding.GetProjectPropertyName(c); // Check for custom types first if (customControls.ContainsKey(typeName)) { // Find and connect the Changed event for the named property if one exists var changedEvent = t.GetEvents().Where(ev => ev.Name == customControls[typeName] + "Changed").FirstOrDefault(); if (changedEvent != null) { Delegate h; if (changedEvent.EventHandlerType == typeof(RoutedPropertyChangedEventHandler <object>)) { h = new RoutedPropertyChangedEventHandler <object>(OnWpfPropertyChanged); } else { h = new EventHandler(OnPropertyChanged); } changedEvent.RemoveEventHandler(c, h); changedEvent.AddEventHandler(c, h); } pi = t.GetProperty(customControls[typeName], BindingFlags.Public | BindingFlags.Instance); } else if (c is Label) { Label l = (Label)c; // No change event for this one but we probably don't need it pi = t.GetProperty("Content", BindingFlags.Public | BindingFlags.Instance); } else if (c is TextBoxBase) { TextBoxBase tb = (TextBoxBase)c; tb.TextChanged -= OnPropertyChanged; tb.TextChanged += OnPropertyChanged; pi = t.GetProperty("Text", BindingFlags.Public | BindingFlags.Instance); } else if (c is Selector) { Selector sel = (Selector)c; sel.SelectionChanged -= OnPropertyChanged; sel.SelectionChanged += OnPropertyChanged; pi = t.GetProperty("SelectedValue", BindingFlags.Public | BindingFlags.Instance); } else if (c is CheckBox) { CheckBox cb = (CheckBox)c; cb.Click -= OnPropertyChanged; cb.Click += OnPropertyChanged; pi = t.GetProperty("IsChecked", BindingFlags.Public | BindingFlags.Instance); } else { pi = null; } // Give the user a chance to handle the control in a custom fashion. If not handled and // we couldn't figure out what to use, ignore it. if (!this.BindControlValue(boundProperty) && pi != null) { this.Bind(c, pi, boundProperty); } } } } finally { this.IsBinding = false; } }
private void SetSliderValues( Slider slider, RoutedPropertyChangedEventHandler<double> handler, double value, double? minimum, double? maximum ) { if( slider != null ) { slider.ValueChanged -= handler; slider.Value = value; if( minimum != null ) { slider.Minimum = minimum.Value; } if( maximum != null ) { slider.Maximum = maximum.Value; } slider.ValueChanged += handler; } }
/// <summary> /// Removes the reorder completed handler. /// </summary> /// <param name="element">The element.</param> /// <param name="handler">The handler.</param> public static void RemoveReorderCompletedHandler(FrameworkElement element, RoutedPropertyChangedEventHandler <int> handler) { element.RemoveHandler(ReorderCompletedEvent, handler); }
public static void RemoveNotificationsChangedHandler(FrameworkElement dobj, RoutedPropertyChangedEventHandler <ObservableCollection <Notification> > handler) => dobj.RemoveHandler(NotificationsChangedEvent, handler);
/* --------------------- Method For Adding Programs To An Existing Department --------------------- */ public static void AddProgram(Grid ppt, int count, int start, Expander department, Dictionary <string, Dictionary <string, float> > functions, SelectionChangedEventHandler ComboBox_SelectionChanged, RoutedPropertyChangedEventHandler <double> Slider_ValueChanged) { char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); for (int i = start; i < start + count; i++) { //Dynamically adding Rows to the Grid RowDefinition rowDef = new RowDefinition(); rowDef.Height = new GridLength(1, GridUnitType.Star); ppt.RowDefinitions.Add(rowDef); // Defining Dock panels for the properties of the Department Programs DockPanel p = new DockPanel(); p.HorizontalAlignment = HorizontalAlignment.Stretch; DockPanel k = new DockPanel(); //k.Orientation = Orientation.Horizontal; k.HorizontalAlignment = HorizontalAlignment.Stretch; k.Name = "keys"; DockPanel r = new DockPanel(); r.HorizontalAlignment = HorizontalAlignment.Stretch; // Programs Label programLabel = new Label(); programLabel.Name = department.Name + "Label" + (i).ToString(); programLabel.HorizontalAlignment = HorizontalAlignment.Stretch; programLabel.HorizontalContentAlignment = HorizontalAlignment.Center; programLabel.Margin = new Thickness(2, 5, 2, 0); programLabel.Width = 25; if (i < alphabet.Length) { programLabel.Content = alphabet[i]; } else { programLabel.Content = (i - alphabet.Length).ToString(); } ComboBox program = new ComboBox(); program.Name = department.Name + "ComboBox" + (i).ToString(); foreach (string functionName in functions.Keys) { if (functions[functionName]["DGSFMax"] != 0 && functions[functionName]["keyMax"] != 0) { ComboBoxItem item = new ComboBoxItem(); item.Content = functionName; program.Items.Add(item); } } program.SelectedIndex = 0; program.HorizontalAlignment = HorizontalAlignment.Stretch; program.Margin = new Thickness(0, 5, 2, 0); program.SelectionChanged += ComboBox_SelectionChanged; p.Children.Add(programLabel); p.Children.Add(program); ppt.Children.Add(p); Grid.SetColumn(p, 0); Grid.SetRow(p, i); // First Item Of The ComboBox ComboBoxItem firstItem = program.Items[0] as ComboBoxItem; // Keys Label keyLabel = new Label(); keyLabel.Content = "Rooms"; Slider keyRooms = new Slider(); keyRooms.Name = department.Name + "Rooms" + (i).ToString(); keyRooms.Minimum = functions[firstItem.Content.ToString()]["keyMin"]; keyRooms.Value = functions[firstItem.Content.ToString()]["keyVal"]; keyRooms.Maximum = functions[firstItem.Content.ToString()]["keyMax"]; keyRooms.TickFrequency = 1; keyRooms.IsSnapToTickEnabled = true; keyRooms.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRight; keyRooms.AutoToolTipPlacement = System.Windows.Controls.Primitives.AutoToolTipPlacement.TopLeft; keyRooms.Margin = new Thickness(0, 5, 0, 0); keyRooms.ValueChanged += Slider_ValueChanged; k.Children.Add(keyLabel); k.Children.Add(keyRooms); ppt.Children.Add(k); Grid.SetColumn(k, 1); Grid.SetRow(k, i); // DGSF Label DGSFLabel = new Label(); DGSFLabel.Content = "DGSF"; Slider DGSF = new Slider(); DGSF.Name = department.Name + "DGSF" + (i).ToString(); DGSF.Minimum = functions[firstItem.Content.ToString()]["DGSFMin"]; DGSF.Value = functions[firstItem.Content.ToString()]["DGSFVal"]; DGSF.Maximum = functions[firstItem.Content.ToString()]["DGSFMax"]; DGSF.TickFrequency = 10; DGSF.IsSnapToTickEnabled = true; DGSF.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRight; DGSF.AutoToolTipPlacement = System.Windows.Controls.Primitives.AutoToolTipPlacement.TopLeft; DGSF.Margin = new Thickness(0, 5, 0, 0); DGSF.ValueChanged += Slider_ValueChanged; r.Children.Add(DGSFLabel); r.Children.Add(DGSF); ppt.Children.Add(r); Grid.SetColumn(r, 2); Grid.SetRow(r, i); } }
/* ------------------------ Method For Generating Elements Inisde Each Department's Expander ------------------------ */ public static void departmentExpanderGenerator(Expander department, int numberOfProgramsInput, Dictionary <string, Dictionary <string, float> > functions, RoutedEventHandler Button_Clicked, SelectionChangedEventHandler ComboBox_SelectionChanged, RoutedPropertyChangedEventHandler <double> Slider_ValueChanged, KeyEventHandler OnKeyUpHandler) { // The Main Container of the Expander StackPanel expanderWrapper = new StackPanel(); expanderWrapper.Name = department.Name + "Wrapper"; expanderWrapper.Background = Brushes.White; // Column Definition for Grids ColumnDefinition c0 = new ColumnDefinition(); ColumnDefinition c1 = new ColumnDefinition(); ColumnDefinition c2 = new ColumnDefinition(); /*--- The Grid for setting up the name of the department input---*/ Grid departmentName = new Grid(); departmentName.Margin = new Thickness(2, 5, 2, 0); c0.Width = new GridLength(1, GridUnitType.Auto); c1.Width = new GridLength(2, GridUnitType.Star); c2.Width = new GridLength(1, GridUnitType.Star); departmentName.ColumnDefinitions.Add(c0); departmentName.ColumnDefinitions.Add(c1); departmentName.ColumnDefinitions.Add(c2); // Label of "Name of the Department" TextBlock name = new TextBlock(); name.Text = "Name of Department"; name.Margin = new Thickness(0, 0, 2, 0); // TextBox for getting the Department's Name TextBox nameInput = new TextBox(); nameInput.HorizontalAlignment = HorizontalAlignment.Stretch; nameInput.Name = department.Name + "NameInputTextBox"; nameInput.Padding = new Thickness(2); nameInput.KeyUp += OnKeyUpHandler; // Button for setting the Departments Name Button setName = new Button(); setName.Content = "SET"; setName.Name = nameInput.Name + "Button"; setName.Click += Button_Clicked; departmentName.Children.Add(name); Grid.SetColumn(name, 0); departmentName.Children.Add(nameInput); Grid.SetColumn(nameInput, 1); departmentName.Children.Add(setName); Grid.SetColumn(setName, 2); expanderWrapper.Children.Add(departmentName); /*--- The Grid for setting up the Number of Programs input ---*/ Grid numOfPrograms = new Grid(); numOfPrograms.Margin = new Thickness(2, 5, 2, 15); c0 = new ColumnDefinition(); c1 = new ColumnDefinition(); c2 = new ColumnDefinition(); c0.Width = new GridLength(1, GridUnitType.Auto); c1.Width = new GridLength(2, GridUnitType.Star); c2.Width = new GridLength(1, GridUnitType.Star); numOfPrograms.ColumnDefinitions.Add(c0); numOfPrograms.ColumnDefinitions.Add(c1); numOfPrograms.ColumnDefinitions.Add(c2); // Label of "Number Of The Programs" TextBlock number = new TextBlock(); number.Text = "Number of Programs"; number.Margin = new Thickness(0, 0, 2, 0); // TextBox for getting the Department's Number Of Programs TextBox numberInput = new TextBox(); numberInput.Text = numberOfProgramsInput.ToString(); numberInput.HorizontalAlignment = HorizontalAlignment.Stretch; numberInput.Name = department.Name + "NumberInputTextBox"; numberInput.Padding = new Thickness(2); numberInput.KeyUp += OnKeyUpHandler; // Button for setting the Departments Name Button setNumber = new Button(); setNumber.Content = "SET"; setNumber.Name = numberInput.Name + "Button"; setNumber.Click += Button_Clicked; numOfPrograms.Children.Add(number); Grid.SetColumn(number, 0); numOfPrograms.Children.Add(numberInput); Grid.SetColumn(numberInput, 1); numOfPrograms.Children.Add(setNumber); Grid.SetColumn(setNumber, 2); expanderWrapper.Children.Add(numOfPrograms); /*--- Adding the programs properties ---*/ Grid programs = new Grid(); programs.Name = department.Name + "Programs"; c0 = new ColumnDefinition(); c1 = new ColumnDefinition(); c2 = new ColumnDefinition(); c0.Width = new GridLength(1, GridUnitType.Star); c1.Width = new GridLength(1, GridUnitType.Star); c2.Width = new GridLength(1, GridUnitType.Star); programs.ColumnDefinitions.Add(c0); programs.ColumnDefinitions.Add(c1); programs.ColumnDefinitions.Add(c2); char[] alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray(); for (int i = 0; i < numberOfProgramsInput; i++) { //Dynamically adding Rows to the Grid RowDefinition rowDef = new RowDefinition(); rowDef.Height = new GridLength(1, GridUnitType.Star); programs.RowDefinitions.Add(rowDef); // Defining Dock panels for the properties of the Department Programs DockPanel p = new DockPanel(); p.HorizontalAlignment = HorizontalAlignment.Stretch; DockPanel k = new DockPanel(); //k.Orientation = Orientation.Horizontal; k.HorizontalAlignment = HorizontalAlignment.Stretch; k.Name = "keys"; DockPanel r = new DockPanel(); r.HorizontalAlignment = HorizontalAlignment.Stretch; // Programs Label programLabel = new Label(); programLabel.Name = department.Name + "Label" + i.ToString(); programLabel.Content = alphabet[i]; programLabel.HorizontalAlignment = HorizontalAlignment.Stretch; programLabel.HorizontalContentAlignment = HorizontalAlignment.Center; programLabel.Margin = new Thickness(2, 5, 2, 0); programLabel.Width = 25; ComboBox program = new ComboBox(); program.Name = department.Name + "ComboBox" + i.ToString(); foreach (string functionName in functions.Keys) { if (functions[functionName]["DGSFMax"] != 0 && functions[functionName]["keyMax"] != 0) { ComboBoxItem item = new ComboBoxItem(); item.Content = functionName; program.Items.Add(item); } } program.SelectedIndex = 0; program.HorizontalAlignment = HorizontalAlignment.Stretch; program.Margin = new Thickness(0, 5, 2, 0); program.SelectionChanged += ComboBox_SelectionChanged; p.Children.Add(programLabel); p.Children.Add(program); programs.Children.Add(p); Grid.SetColumn(p, 0); Grid.SetRow(p, i); // First Item Of The ComboBox ComboBoxItem firstItem = program.Items[0] as ComboBoxItem; // Keys Label keyLabel = new Label(); keyLabel.Content = "Rooms"; Slider keyRooms = new Slider(); keyRooms.Name = department.Name + "Rooms" + i.ToString(); keyRooms.Minimum = functions[firstItem.Content.ToString()]["keyMin"]; keyRooms.Value = functions[firstItem.Content.ToString()]["keyVal"]; keyRooms.Maximum = functions[firstItem.Content.ToString()]["keyMax"]; keyRooms.TickFrequency = 1; keyRooms.IsSnapToTickEnabled = true; keyRooms.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRight; keyRooms.AutoToolTipPlacement = System.Windows.Controls.Primitives.AutoToolTipPlacement.TopLeft; keyRooms.Margin = new Thickness(0, 5, 0, 0); keyRooms.ValueChanged += Slider_ValueChanged; k.Children.Add(keyLabel); k.Children.Add(keyRooms); programs.Children.Add(k); Grid.SetColumn(k, 1); Grid.SetRow(k, i); // DGSF Label DGSFLabel = new Label(); DGSFLabel.Content = "DGSF"; Slider DGSF = new Slider(); DGSF.Name = department.Name + "DGSF" + i.ToString(); DGSF.Minimum = functions[firstItem.Content.ToString()]["DGSFMin"]; DGSF.Value = functions[firstItem.Content.ToString()]["DGSFVal"]; DGSF.Maximum = functions[firstItem.Content.ToString()]["DGSFMax"]; DGSF.TickFrequency = 10; DGSF.IsSnapToTickEnabled = true; DGSF.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRight; DGSF.AutoToolTipPlacement = System.Windows.Controls.Primitives.AutoToolTipPlacement.TopLeft; DGSF.Margin = new Thickness(0, 5, 0, 0); DGSF.ValueChanged += Slider_ValueChanged; r.Children.Add(DGSFLabel); r.Children.Add(DGSF); programs.Children.Add(r); Grid.SetColumn(r, 2); Grid.SetRow(r, i); } expanderWrapper.Children.Add(programs); department.Content = expanderWrapper; }
/// <summary> /// Called when the value of the State property changes. /// </summary> /// <param name="oldValue">The value to be replaced.</param> /// <param name="newValue">The new value.</param> protected virtual void OnStatePropertyChanged(DataPointState oldValue, DataPointState newValue) { if (!IsCoercingState) { // If state ever goes to or past PendingRemoval, the DataPoint is no longer active if (DataPointState.PendingRemoval <= newValue) { IsActive = false; } if (newValue < oldValue) { // If we've somehow gone backwards in the life cycle (other // than when we go back to normal from updating) coerce to // old value. IsCoercingState = true; this.State = oldValue; IsCoercingState = false; } else { // Update selection if (newValue > DataPointState.Normal) { this.IsSelectionEnabled = false; } // Start state transition bool transitionStarted = false; switch (newValue) { case DataPointState.Showing: case DataPointState.Hiding: transitionStarted = GoToCurrentRevealState(); break; } // Fire Changed event RoutedPropertyChangedEventHandler <DataPointState> handler = this.StateChanged; if (handler != null) { handler(this, new RoutedPropertyChangedEventArgs <DataPointState>(oldValue, newValue)); } // Change state if no transition started if (!transitionStarted && _templateApplied) { switch (newValue) { case DataPointState.Showing: State = DataPointState.Normal; break; case DataPointState.Hiding: State = DataPointState.Hidden; break; } } } } }
public MultiSelectTreeView() { SelectedItemChanged += new RoutedPropertyChangedEventHandler <object>(MultiSelectTreeView_SelectedItemChanged); }
public MultiSelectTreeView() { SelectedItemChanged += new RoutedPropertyChangedEventHandler<object>(MultiSelectTreeView_SelectedItemChanged); }
/// <summary>Invokes event handlers in a type-specific way, which can increase event system efficiency.</summary> /// <param name="genericHandler">The generic handler to call in a type-specific way.</param> /// <param name="genericTarget">The target to call the handler on.</param> // Token: 0x0600088E RID: 2190 RVA: 0x0001BD18 File Offset: 0x00019F18 protected override void InvokeEventHandler(Delegate genericHandler, object genericTarget) { RoutedPropertyChangedEventHandler <T> routedPropertyChangedEventHandler = (RoutedPropertyChangedEventHandler <T>)genericHandler; routedPropertyChangedEventHandler(genericTarget, this); }
public UiEncodingLabeledNumber(string label, int width, int minValue, int maxValue, RoutedPropertyChangedEventHandler <object> onValueChanged) { _onValueChanged = onValueChanged; ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); ColumnDefinitions.Add(new ColumnDefinition()); Margin = new Thickness(5); UiTextBlock labelControl = UiTextBlockFactory.Create(label); { labelControl.Margin = new Thickness(5, 5, 2, 5); labelControl.VerticalAlignment = VerticalAlignment.Center; AddUiElement(labelControl, 0, 0); } NumberControl = UiIntegerUpDownFactory.Create(minValue, maxValue); { NumberControl.Width = width; NumberControl.Margin = new Thickness(2, 5, 5, 5); NumberControl.ValueChanged += OnValueChanged; AddUiElement(NumberControl, 0, 1); } }
public static void RemoveWindowRectChangedHandler(MdiWindow window, RoutedPropertyChangedEventHandler<Rect> handler) { window.RemoveHandler(WindowRectChangedEvent, handler); }
public ExtendedTreeView() : base() { SelectedItemChanged += new RoutedPropertyChangedEventHandler<object>(___ICH); }
public static void RemoveWindowRectChangedHandler(MdiWindow window, RoutedPropertyChangedEventHandler <Rect> handler) { window.RemoveHandler(WindowRectChangedEvent, handler); }
public BindableScrollBar() { scrollBarValueChangedHandler = OnScrollBarValueChanged; scrollViewerScrollChangedHandler = OnScrollViewerScrollChanged; }
/// <summary> /// Removes the reorder completed handler. /// </summary> /// <param name="element">The element.</param> /// <param name="handler">The handler.</param> public static void RemoveReorderCompletedHandler(FrameworkElement element, RoutedPropertyChangedEventHandler<int> handler) { element.RemoveHandler(ReorderCompletedEvent, handler); }