public StopEntry(SliderShowValues distance, SliderShowValues percent) { this.Distance = distance; this.Percent = percent; distance.ValueChanged += new EventHandler(Slider_ValueChanged); percent.ValueChanged += new EventHandler(Slider_ValueChanged); }
public PropSync(SliderShowValues slider, PropertyInfo prop, object item, double desiredMin, double desiredMax) { _desiredMin = desiredMin; _desiredMax = desiredMax; _slider = slider; _prop = prop; // Using the public property, because it modifies slider this.Item = item; _slider.ValueChanged += new EventHandler(Slider_ValueChanged); }
public PropSync(SliderShowValues slider, PropertyInfo prop, object item, double desiredMin, double desiredMax) { _desiredMin = desiredMin; _desiredMax = desiredMax; _slider = slider; _prop = prop; // Using the public property, because it modifies slider this.Item = item; _slider.ValueChanged += new EventHandler(Slider_ValueChanged); }
private void Insert(int index, double distance, double percent) { #region Validate if (index < 0 || index > _entries.Count) { throw new ArgumentException("Insert index is out of range"); } if (distance < 0) { throw new ArgumentException("Distance can't be negative"); } #endregion // Create the row SliderShowValues distanceCtrl = new SliderShowValues() { Minimum = 0, Maximum = Math.Max(10, distance * 4), Value = distance, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }; SliderShowValues percentCtrl = new SliderShowValues() { Minimum = Math.Min(0, percent), Maximum = Math.Max(1, percent), Value = percent, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }; StopEntry entry = new StopEntry(distanceCtrl, percentCtrl); _entries.Insert(index, entry); // Add to grid Grid.SetColumn(entry.Distance, 0); Grid.SetColumn(entry.Percent, 2); if (grdStops.RowDefinitions.Count - 1 == index) { grdStops.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Auto) }); } grdStops.Children.Add(entry.Distance); grdStops.Children.Add(entry.Percent); SyncGridRowIndices(); entry.ValueChanged += new EventHandler(Entry_ValueChanged); txtInsertIndex.Text = _entries.Count.ToString(); }
private UIElement GetColumnVisual(ColumnStats column, Style headerStyle, Style promptStyle, Style valueStyle, Style sliderStyle) { Grid grid = new Grid();// { HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, Background = Brushes.Yellow, }; grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(10) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Auto), SharedSizeGroup = "itemPrompt" }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(5) }); grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star), SharedSizeGroup = "itemValue" }); #region header TextBlock text = new TextBlock() { Text = column.Name, Style = headerStyle, }; grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength() }); Grid.SetColumn(text, 0); Grid.SetColumnSpan(text, 4); Grid.SetRow(text, grid.RowDefinitions.Count - 1); grid.Children.Add(text); #endregion #region datatype // Type text = new TextBlock() { Text = column.FieldStats.FieldType.ToString(), Style = promptStyle, }; grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(2) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength() }); Grid.SetColumn(text, 1); Grid.SetRow(text, grid.RowDefinitions.Count - 1); grid.Children.Add(text); // Checkbox if (column.FieldStats.FieldType != SOMFieldType.AlphaNumeric && column.FieldStats.FieldType != SOMFieldType.AnyText) { CheckBox checkbox = new CheckBox() { Content = "Force text", Tag = column, }; checkbox.Checked += ColumnTextCheckbox_Checked; checkbox.Unchecked += ColumnTextCheckbox_Checked; Grid.SetColumn(checkbox, 3); Grid.SetRow(checkbox, grid.RowDefinitions.Count - 1); grid.Children.Add(checkbox); } #endregion #region vector width // Prompt text = new TextBlock() { Text = "vector width", Style = promptStyle, }; grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(2) }); grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength() }); Grid.SetColumn(text, 1); Grid.SetRow(text, grid.RowDefinitions.Count - 1); grid.Children.Add(text); // Value SliderShowValues slider = new SliderShowValues() { Minimum = 1, Maximum = 10, Value = 5, IsInteger = true, Tag = column, Style = sliderStyle, }; slider.ValueChanged += ColumnSlider_ValueChanged; Grid.SetColumn(slider, 3); Grid.SetRow(slider, grid.RowDefinitions.Count - 1); grid.Children.Add(slider); #endregion // counts AddDescriptionRow(grid, "count", column.FieldStats.Count.ToString("N0"), promptStyle, valueStyle); AddDescriptionRow(grid, "unique", column.FieldStats.UniqueCount.ToString("N0"), promptStyle, valueStyle); #region datatype specific fields switch (column.FieldStats.FieldType) { case SOMFieldType.AlphaNumeric: case SOMFieldType.AnyText: ShowUsedColumnStats_Text(grid, column.FieldStats, promptStyle, valueStyle); break; case SOMFieldType.DateTime: ShowUsedColumnStats_Datetime(grid, column.FieldStats, promptStyle, valueStyle); break; case SOMFieldType.FloatingPoint: case SOMFieldType.Integer: ShowUsedColumnStats_Number(grid, column.FieldStats, promptStyle, valueStyle); break; default: throw new ApplicationException("Unknown SOMFieldType: " + column.FieldStats.FieldType.ToString()); } #endregion return new Border() { Child = grid, Padding = new Thickness(4), }; }