private void OnCellModeChangedHandler(object sender, EventArgs e) { if (!Element_BlockGridLayerContainer.CellMode) _contentGrid2ndRowDefinitionHeight = new GridLength(ContentGrid.RowDefinitions[1].ActualHeight, GridUnitType.Star); if (!Element_BlockGridLayerContainer.CellMode) _contentGrid1stRowDefinitionHeight = new GridLength(ContentGrid.RowDefinitions[0].ActualHeight, GridUnitType.Star); ContentGrid.RowDefinitions[0].Height = _contentGrid1stRowDefinitionHeight.Value; ContentGrid.RowDefinitions[1].Height = Element_BlockGridLayerContainer.CellMode ? _contentGrid2ndRowDefinitionHeight.Value : new GridLength(0); if (Element_BlockGridLayerContainer.CellMode) { BindingOperations.SetBinding(AssignmentEstimationGrid, ScheduleGrid.ScreenStartProperty, new Binding("ScreenStart")); //xBindingOperations.SetBinding(LinechartDashboard, ScheduleGrid.ScreenStartProperty, new Binding("SelectedColumnDate")); //xBindingOperations.ClearBinding(LinechartDashboard, ScheduleGrid.ScreenStartProperty); } else { BindingOperations.ClearBinding(AssignmentEstimationGrid, ScheduleGrid.ScreenStartProperty); //xBindingOperations.SetBinding(LinechartDashboard, ScheduleGrid.ScreenStartProperty, new Binding("ScreenStart")); //x BindingOperations.SetBinding(LinechartDashboard, ScheduleGrid.ScreenStartProperty, new Binding("ScreenStart"){Source = DataContext, Mode = BindingMode.OneWay}); } }
private void internalVisibbleChange() { var parent = base.Parent as Grid; if (parent == null) { return; } int columnIndex = Grid.GetColumn(this); if (columnIndex + 1 >= parent.ColumnDefinitions.Count) { return; } var lastColumn = parent.ColumnDefinitions[columnIndex + 1]; if (!IsVisible && lastColumn.Width.Value == 0) { return; } if (this.Visibility == Visibility.Visible) { lastColumn.Width = _width ?? lastColumn.Width; } else { _width = lastColumn.Width; lastColumn.Width = new GridLength(0); } }
/// <summary> /// Adds single item at new row, new row will be added to Grid /// </summary> /// <param name="grid"></param> /// <param name="item"></param> /// <param name="height"></param> /// <param name="column">default is -1, it will add item with colspan equal to number of columns</param> public static void AddRowItem( this Grid grid, View item, GridLength?height = null, int column = -1 ) { var row = new RowDefinition { }; if (height != null) { row.Height = height.Value; } int index = grid.RowDefinitions.Count; grid.RowDefinitions.Add(row); Grid.SetRow(item, index); if (column == -1) { Grid.SetColumnSpan(item, grid.ColumnDefinitions.Count); } else { Grid.SetColumn(item, column); } grid.Children.Add(item); }
public static Grid WithRow(this Grid grid, GridLength?Height = default(GridLength?), double?MinHeight = null, double?MaxHeight = null, string SharedSizeGroup = null) { var row = new RowDefinition(); if (Height.HasValue) { row.Height = Height.Value; } if (MinHeight.HasValue) { row.MinHeight = MinHeight.Value; } if (MaxHeight.HasValue) { row.MaxHeight = MaxHeight.Value; } if (SharedSizeGroup != null) { row.SharedSizeGroup = SharedSizeGroup; } grid.RowDefinitions.Add(row); return(grid); }
private void OnCellModeChangedHandler(object sender, EventArgs e) { if (!Element_BlockGridLayerContainer.CellMode) { _contentGrid2ndRowDefinitionHeight = new GridLength(ContentGrid.RowDefinitions[1].ActualHeight, GridUnitType.Star); } if (!Element_BlockGridLayerContainer.CellMode) { _contentGrid1stRowDefinitionHeight = new GridLength(ContentGrid.RowDefinitions[0].ActualHeight, GridUnitType.Star); } ContentGrid.RowDefinitions[0].Height = _contentGrid1stRowDefinitionHeight.Value; ContentGrid.RowDefinitions[1].Height = Element_BlockGridLayerContainer.CellMode ? _contentGrid2ndRowDefinitionHeight.Value : new GridLength(0); if (Element_BlockGridLayerContainer.CellMode) { BindingOperations.SetBinding(AssignmentEstimationGrid, ScheduleGrid.ScreenStartProperty, new Binding("ScreenStart")); //xBindingOperations.SetBinding(LinechartDashboard, ScheduleGrid.ScreenStartProperty, new Binding("SelectedColumnDate")); //xBindingOperations.ClearBinding(LinechartDashboard, ScheduleGrid.ScreenStartProperty); } else { BindingOperations.ClearBinding(AssignmentEstimationGrid, ScheduleGrid.ScreenStartProperty); //xBindingOperations.SetBinding(LinechartDashboard, ScheduleGrid.ScreenStartProperty, new Binding("ScreenStart")); //x BindingOperations.SetBinding(LinechartDashboard, ScheduleGrid.ScreenStartProperty, new Binding("ScreenStart"){Source = DataContext, Mode = BindingMode.OneWay}); } }
private void SetContainerSizeInternal(string containerName, GridLength?width, GridLength?height) { var toolContainer = DockingManager.FindObjectByName <LayoutAnchorablePane>(containerName); var viewContainer = DockingManager.FindObjectByName <LayoutDocumentPane>(containerName); if (width.HasValue) { if (toolContainer != null) { toolContainer.DockWidth = width.Value; } if (viewContainer != null) { viewContainer.DockWidth = width.Value; } } if (height.HasValue) { if (toolContainer != null) { toolContainer.DockHeight = height.Value; } if (viewContainer != null) { viewContainer.DockHeight = height.Value; } } }
public static void CreateRowsForGrid(int num, Grid grid, GridLength?rowHeight) { for (int i = 0; i < num; i++) { var rowDefinition = new RowDefinition(); if (rowHeight.HasValue) { rowDefinition.Height = rowHeight.Value; } grid.RowDefinitions.Add(rowDefinition); } }
public PrivacyTextColumn( object?header, Func <T, string?> getter, GridLength?width, ColumnOptions <T>?options, int numberOfPrivacyChars = 0) : base(header, width, options) { _sortAscending = options?.CompareAscending; _sortDescending = options?.CompareDescending; _getter = getter; _numberOfPrivacyChars = numberOfPrivacyChars; }
protected virtual void OnCollapsed() { if (!AutoResizeGrid) { return; } var grid = Parent as Grid; if (grid == null) { return; } switch (ExpandDirection) { case ExpandDirection.Left: { var column = Grid.GetColumn(this); _expandDistance = grid.ColumnDefinitions[column].Width; grid.ColumnDefinitions[column].SetCurrentValue(ColumnDefinition.WidthProperty, GridLength.Auto); break; } case ExpandDirection.Right: { var column = Grid.GetColumn(this); _expandDistance = grid.ColumnDefinitions[column].Width; grid.ColumnDefinitions[column].SetCurrentValue(ColumnDefinition.WidthProperty, GridLength.Auto); break; } case ExpandDirection.Up: { var row = Grid.GetRow(this); _expandDistance = grid.RowDefinitions[row].Height; grid.RowDefinitions[row].SetCurrentValue(RowDefinition.HeightProperty, GridLength.Auto); break; } case ExpandDirection.Down: { var row = Grid.GetRow(this); _expandDistance = grid.RowDefinitions[row].Height; grid.RowDefinitions[row].SetCurrentValue(RowDefinition.HeightProperty, GridLength.Auto); break; } } }
/* 项目类型 * text 直接作为文本显示。默认。 * choice 根据内容映射。要求data传入一个IDictionary<string,string>(值-显示)的字典用于显示。 * custom 自定义。要求data传入一个Func<JToken,string>类型的委托以处理对象的JToken数据。 */ public Column(string name, string header, GridLength?width = null, string ordering = null, double?fontsize = null, Thickness?margin = null, string type = "text", object data = null, Func <JToken, Tuple <string, IDictionary <string, object> > > hyperlink = null, Action <JToken> customaction = null) { this.name = name; this.header = header; this.fontsize = fontsize; this.ordering = ordering; this.margin = margin; this.type = type; this.data = data; this.hyperlink = hyperlink; this.width = width ?? new GridLength(1, GridUnitType.Star); this.customaction = customaction; }
//private GridLength MinWidthBackup = new GridLength(0); private void Sidebar_Collapsed(object sender, RoutedEventArgs e) { if (Mode == ModeOptions.Normal) { if (ExpandDirection == ExpandDirection.Left || ExpandDirection == ExpandDirection.Right) { SizeExpandedBackup = StoredWidth = new GridLength(ActualWidth); // MinWidthBackup = MinWidth; SetCurrentValue(StoredWidthProperty, GridLength.Auto); } if (ExpandDirection == ExpandDirection.Down || ExpandDirection == ExpandDirection.Up) { SizeExpandedBackup = StoredHeight = new GridLength(ActualHeight); SetCurrentValue(StoredHeightProperty, GridLength.Auto); } } }
public bool Replace(ModelBase prev, ModelBase next) { if (Item1 == prev) { var sizeTemp = Item1Size; Item1 = next; Item1Size = sizeTemp; return(true); } else if (Item2 == prev) { var sizeTemp = Item2Size; Item2 = next; Item2Size = sizeTemp; return(true); } return(false); }
public override void ReadXml(System.Xml.XmlReader reader) { if (reader.MoveToAttribute("DockWidth")) { _dockWidth = ( GridLength )_gridLengthConverter.ConvertFromInvariantString(reader.Value); } if (reader.MoveToAttribute("DockHeight")) { _dockHeight = ( GridLength )_gridLengthConverter.ConvertFromInvariantString(reader.Value); } if (reader.MoveToAttribute("DocMinWidth")) { _dockMinWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("DocMinHeight")) { _dockMinHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("FloatingWidth")) { _floatingWidth = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("FloatingHeight")) { _floatingHeight = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("FloatingLeft")) { _floatingLeft = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("FloatingTop")) { _floatingTop = double.Parse(reader.Value, CultureInfo.InvariantCulture); } if (reader.MoveToAttribute("IsMaximized")) { _isMaximized = bool.Parse(reader.Value); } base.ReadXml(reader); }
private void SnapshotRowHeights() { this.length1 = null; this.length2 = null; if (this.grid != null) { var indices = this.GetDefinitionIndices(); if (indices.Item1.HasValue) { this.length1 = grid.RowDefinitions[indices.Item1.Value].Height; } if (indices.Item2.HasValue) { this.length2 = grid.RowDefinitions[indices.Item2.Value].Height; } } }
private void SnapshotColumnWidths() { this.length1 = null; this.length2 = null; if (this.grid != null) { var indices = this.GetDefinitionIndices(); if (indices.Item1.HasValue) { this.length1 = this.grid.ColumnDefinitions[indices.Item1.Value].Width; } if (indices.Item2.HasValue) { this.length2 = this.grid.ColumnDefinitions[indices.Item2.Value].Width; } } }
/// <summary> /// Adds new row with specified gridlength, note this will add new row to row definitions, please note you must add columns before calling this /// </summary> /// <param name="grid"></param> /// <param name="height"></param> /// <param name="views"></param> public static void AddRowItems(this Grid grid, GridLength?height = null, params View[] views) { var row = new RowDefinition { }; if (height != null) { row.Height = height.Value; } int index = grid.RowDefinitions.Count; grid.RowDefinitions.Add(row); for (int i = 0; i < views.Length; i++) { var item = views[i]; Grid.SetRow(item, index); Grid.SetColumn(item, i); grid.Children.Add(item); } }
private void OnExpanderContentSizeChanged(object sender, SizeChangedEventArgs e) { if (!_sizeInitialized) { _sizeInitialized = true; _dimensionSize = _expanderSize.DimensionSize; return; } if (!_sizeInitialized) { return; } if (_sizeManuallyChanged) { _sizeManuallyChanged = false; } else { _newDimensionSize = _expanderSize.DimensionSize; } }
private void Sidebar_Expanded(object sender, RoutedEventArgs e) { if (Mode == ModeOptions.Normal) { if (ExpandDirection == ExpandDirection.Left || ExpandDirection == ExpandDirection.Right) { SizeCollapsedBackup = StoredWidth; if (SizeExpandedBackup == null) { SizeExpandedBackup = new GridLength(200); } SetCurrentValue(StoredWidthProperty, SizeExpandedBackup); } if (ExpandDirection == ExpandDirection.Down || ExpandDirection == ExpandDirection.Up) { SizeCollapsedBackup = StoredHeight; if (SizeCollapsedBackup == null) { SizeExpandedBackup = new GridLength(200); } SetCurrentValue(StoredHeightProperty, SizeExpandedBackup); } } }
protected override void OnCollapsed() { _rowHeight = RowDefinition.Height; RowDefinition.Height = GridLength.Auto; base.OnCollapsed(); }
internal static Result Parse(string value) { if (string.IsNullOrEmpty(value)) { throw new FormatException(DiagnosticMessages.GridLengthParser_InvalidInput(value)); } GridLength?length = null; double? minLength = null; double? maxLength = null; var splits = value.Split(';'); var splitCount = splits.Length; if (string.IsNullOrEmpty(splits[splits.Length - 1].Trim())) { splitCount--; } if (splitCount < 1 || splitCount > 3) { throw new FormatException(DiagnosticMessages.GridLengthParser_InvalidInput(value)); } for (int i = 0; i < splitCount; i++) { var result = ParseNameGridLengthPair(splits[i]); if (!result.HasValue) { throw new FormatException(DiagnosticMessages.GridLengthParser_InvalidInput(value)); } var pair = result.GetValueOrDefault(); var name = pair.Name; var gridLength = pair.GridLength; if (string.IsNullOrEmpty(name)) { if (length.HasValue) { throw new FormatException(DiagnosticMessages.GridLengthParser_InvalidInput(value)); } length = gridLength; } else if (name == "min") { if (minLength.HasValue) { throw new FormatException(DiagnosticMessages.GridLengthParser_InvalidInput(value)); } minLength = gridLength.Value; } else { Debug.Assert(name == "max"); if (maxLength.HasValue) { throw new FormatException(DiagnosticMessages.GridLengthParser_InvalidInput(value)); } maxLength = gridLength.Value; } } if (!length.HasValue) { throw new FormatException(DiagnosticMessages.GridLengthParser_InvalidInput(value)); } double min = minLength.HasValue ? minLength.GetValueOrDefault() : 0.0; double max = maxLength.HasValue ? maxLength.GetValueOrDefault() : double.PositiveInfinity; if (min < 0 || min > max) { throw new FormatException(DiagnosticMessages.GridLengthParser_InvalidInput(value)); } return(new Result(length.GetValueOrDefault(), min, max)); }
public GridChildLength(GridLength length, double?min = null, double?max = null) { this.GridLength = length; this.MinLength = min; this.MaxLength = max; }
public static void SetRowHeight(DependencyObject obj, GridLength?rowHeight) { obj.SetValue(AutoGrid.RowHeightProperty, rowHeight); }
public static void SetRowHeightOverride(DependencyObject element, GridLength?value) { element.SetValue(RowHeightOverrideProperty, value); }
public static void SetColumnWidthOverride(DependencyObject element, GridLength?value) { element.SetValue(ColumnWidthOverrideProperty, value); }
protected override void OnCollapsed() { _rowHeight = RowDefinition.Height; RowDefinition.Height = GridLength.Auto; base.OnCollapsed(); }
/// <summary> /// Applique des paramètres à l'instance actuelle de VGMGUI. /// </summary> /// <param name="data">Les paramètres à appliquer.</param> public void ApplySettings(IniData data, bool startup = false) { object o; App.SetLanguage(data.Global["Language"] ?? "Auto"); if ((o = data.Global["StopWhenDelete"].ToBool()) != null) { StopPlayingWhenDeleteFile = (bool)o; } if ((o = data.Global["PreAnalyse"].ToBool()) != null) { PreAnalyse = (bool)o; } if (startup && (o = data.Global["Preview"]) != null) { switch (o) { case "In": ALERadioButton.IsChecked = true; break; case "Out": ALSRadioButton.IsChecked = true; break; } } if ((o = data.Global["SamplesDisplay"]) != null) { switch (o) { case "S": HMSSamplesDisplay = false; break; case "HMS": HMSSamplesDisplay = true; break; } } if ((o = data.Global["SamplesDisplayMaxDec"].ToInt()) != null) { SamplesDisplayMaxDec = ((int)o); } if ((o = data["Search"]["SearchDelay"].ToInt()) != null) { SearchDelay = ((int)o); } if (startup) { o = data.Global["LoopType"]; { switch (o) { case "None": AP.LoopType = LoopTypes.None; break; case "All": AP.LoopType = LoopTypes.All; break; case "Random": AP.LoopType = LoopTypes.Random; break; } } if ((o = data.Global["Volume"].ToInt()) != null) { AP.Volume = (int)o; } if ((o = data.Global["Mute"].ToBool()) != null) { AP.Mute = (bool)o; } if ((o = data.Global["ConversionFolderName"]) != null) { MainDestTB.Text = o as string; } if ((o = SettingsData.Global["DefaultOutData"]?.Replace("\"", string.Empty)?.Split(new[] { " | " }, StringSplitOptions.None)) != null) { var outData = (string[])o; var s = SettingsData.Global["DefaultOutData"]; if (outData.Length == 6) { DefaultOutData = new FichierOutData() { OriginalDestination = outData[0], FadeDelay = outData[1].ToDouble(), FadeOut = outData[2].ToBool(), FadeTime = outData[3].ToDouble(), LoopCount = outData[4].ToInt(), StartEndLoop = outData[5].ToBool(), }; } } if ((o = SettingsData.Global["ColumnsInfo"]?.Split(new[] { " | " }, StringSplitOptions.RemoveEmptyEntries)) != null) { var columns = (tasklist.FILEList.View as GridView).Columns; var oldColumns = columns.ToArray(); var columnsInfo = ((string[])o).Select(info => { var num = info.Split(new[] { " : " }, StringSplitOptions.None); if (num.Length == 2) { var index = num[0].ToInt(); return(Index: index ?? 0, Width: index == null ? double.NaN : num[1].ToDouble() ?? double.NaN); } else { return(Index: 0, Width: double.NaN); } }).Where(info => !double.IsNaN(info.Width)).ToArray(); if (columnsInfo.Length == oldColumns.Length && !columnsInfo.OrderBy(i => i.Index).Select((i, j) => i.Index - j).Distinct().Skip(1).Any()) { for (int i = 0; i < oldColumns.Length; i++) { int oldIndex = columns.IndexOf(oldColumns[i]); int newIndex = columnsInfo[i].Index; columns.Move(oldIndex, newIndex); columns[newIndex].Width = columnsInfo[i].Width; } } } if ((o = data["Window"]["Width"].ToDouble()) != null) { Width = (double)o; } if ((o = data["Window"]["Height"].ToDouble()) != null) { Height = (double)o; } if ((o = data["Window"]["State"].ToEnum <WindowState>()) != null && (WindowState)o != WindowState.Minimized) { WindowState = (WindowState)o; } if ((o = SettingsData["Grids"]["TopGrid"]?.Split(new[] { " | " }, StringSplitOptions.RemoveEmptyEntries)) is string[] columndefsstr && columndefsstr.Length == 2) { var columndefs = new GridLength?[] { columndefsstr[0].ToGridLength(), columndefsstr[1].ToGridLength() }; if (!columndefs.Contains(null)) { TopGrid.ColumnDefinitions[0].Width = (GridLength)columndefs[0]; TopGrid.ColumnDefinitions[1].Width = (GridLength)columndefs[1]; } } if ((o = SettingsData["Grids"]["RightGrid"]?.Split(new[] { " | " }, StringSplitOptions.RemoveEmptyEntries)) is string[] rowdefsstr && rowdefsstr.Length == 2) { var rowdefs = new GridLength?[] { rowdefsstr[0].ToGridLength(), rowdefsstr[1].ToGridLength() }; if (!rowdefs.Contains(null)) { RightGrid.RowDefinitions[0].Height = (GridLength)rowdefs[0]; RightGrid.RowDefinitions[1].Height = (GridLength)rowdefs[1]; } } if ((o = data["Search"]["SearchFilter"]) != null) { RestoreSearchFilter = o as string; } if ((o = data["Search"]["SearchColumn"].ToEnum <FileListColumn>()) != null) { SearchColumn = (FileListColumn)o; } if ((o = data["Search"]["CaseSensitive"].ToBool()) != null) { SearchCaseSensitive = ((bool)o); } if ((o = data["Search"]["Regex"].ToBool()) != null) { SearchRegex = ((bool)o); } } if ((o = data["Multithreading"]["Conversion"].ToBool()) != null) { ConversionMultithreading = (bool)o; } if ((o = data["Multithreading"]["MaxConversion"].ToInt()) != null) { ConversionMaxProcessCount = (int)o; } if ((o = data["Multithreading"]["Adding"].ToBool()) != null) { AddingMultithreading = (bool)o; } if ((o = data["Multithreading"]["MaxAdding"].ToInt()) != null) { AddingMaxProcessCount = (int)o; } if ((o = data["StatusBar"]["Display"].ToBool()) != null) { StatusBar.Display = (bool)o; } if ((o = data["StatusBar"]["Counter"].ToBool()) != null) { StatusBar.Counter = (bool)o; } if ((o = data["StatusBar"]["RAM"].ToBool()) != null) { StatusBar.RAM = (bool)o; } if ((o = data["StatusBar"]["SamplesDisplay"].ToBool()) != null) { StatusBar.SamplesDisplay = (bool)o; } if ((o = data["StatusBar"]["SearchDelay"].ToBool()) != null) { StatusBar.SearchDelay = (bool)o; } if ((o = data["StatusBar"]["PreAnalyse"].ToBool()) != null) { StatusBar.PreAnalyse = (bool)o; } if ((o = data["StatusBar"]["StreamingType"].ToBool()) != null) { StatusBar.StreamingType = (bool)o; } if ((o = data["StatusBar"]["Size"].ToBool()) != null) { StatusBar.Size = (bool)o; } if ((o = data["StatusBar"]["Conversion"].ToBool()) != null) { StatusBar.Conversion = (bool)o; } if ((o = data.Global["StreamingType"].ToEnum <StreamingType>()) != null) { Settings.StreamingType = (StreamingType)o; } //if ((o = data["AdditionalFormats"]["DKCTFCSMP"].ToBool()) != null) AdditionalFormats.DKCTFCSMP = (bool)o; if ((o = data["Colors"]["Foreground"].ToColor()) != null) { Color ocolor = (Color)o; Application.Current.Resources["ForegroundBrush"] = new SolidColorBrush(ocolor).GetAsTypedFrozen(); Application.Current.Resources["ForegroundBrush_Disabled"] = new SolidColorBrush(Color.FromArgb(80, ocolor.R, ocolor.G, ocolor.B)).GetAsTypedFrozen(); } if ((o = data["Colors"]["Background"].ToColor()) != null) { Color ocolor = (Color)o; Application.Current.Resources["BackgroundBrush"] = new SolidColorBrush(ocolor).GetAsTypedFrozen(); Application.Current.Resources["BackgroundBrush_Disabled"] = new SolidColorBrush(Color.FromArgb(80, ocolor.R, ocolor.G, ocolor.B)).GetAsTypedFrozen(); } if ((o = data["Colors"]["Error"].ToColor()) != null) { Color ocolor = (Color)o; Application.Current.Resources["ErrorBrush"] = new SolidColorBrush(ocolor).GetAsTypedFrozen(); Application.Current.Resources["ErrorBrush_Disabled"] = new SolidColorBrush(Color.FromArgb(80, ocolor.R, ocolor.G, ocolor.B)).GetAsTypedFrozen(); foreach (Fichier fichier in tasklist.Files) { fichier.RefreshValidity(); } } RefreshInfos(); UpdateStatusBar(false, true); }
/// <summary> /// Sets the width or height of a column or row at a given index. /// </summary> /// <param name="index">The index of the column or row.</param> /// <param name="size">The width or height.</param> public abstract void SetSize(int index, GridLength?size);
private void Expander_Collapsed(object sender, RoutedEventArgs e) { _columnWidth = column0.Width; column0.Width = GridLength.Auto; gridSplitter.IsEnabled = false; }
/// <summary> /// Sets the width or height of a row at a given index. /// </summary> /// <param name="index">The index of the row.</param> /// <param name="size">The width or height.</param> public override void SetSize(int index, GridLength?size) { definitions[index].Height = size.HasValue ? size.Value : Owner.DefaultRowHeight; }
/// <summary> /// Sets the width or height of a column at a given index. /// </summary> /// <param name="index">The index of the column.</param> /// <param name="size">The width or height.</param> public override void SetSize(int index, GridLength?size) { definitions[index].Width = size.HasValue ? size.Value : Owner.DefaultColumnWidth; }
private void Expander_Collapsed(object sender, RoutedEventArgs e) { _columnWidth = column0.Width; column0.Width = GridLength.Auto; }
public GridChildLength(GridLength length, double?min = null, double?max = null) { GridLength = length; MinLength = min; MaxLength = max; }
public GridLabel(ICollection <string> contents, double fontSize, Brush foreground, Grid grid, GridDefinitions gridDefinitions, GridLength?gridLength, int index) { foreach (string content in contents) { var label = new Label(); label.Content = content; label.FontSize = fontSize; if (foreground != null) { label.Foreground = foreground; } switch (gridDefinitions) { case GridDefinitions.Column: grid.ColumnDefinitions.Add(new ColumnDefinition()); if (gridLength != null) { grid.ColumnDefinitions[index].Width = (GridLength)gridLength; } Grid.SetColumn(label, index); break; case GridDefinitions.Row: grid.RowDefinitions.Add(new RowDefinition()); if (gridLength != null) { grid.RowDefinitions[index].Height = (GridLength)gridLength; } Grid.SetRow(label, index); break; } grid.Children.Add(label); break; } //var label = new Label(); //label.Content = content; //label.FontSize = fontSize; //if (foreground != null) // label.Foreground = foreground; //switch (gridDefinitions) //{ // case GridDefinitions.Column: // grid.ColumnDefinitions.Add(new ColumnDefinition()); // if (gridLength != null) // grid.ColumnDefinitions[index].Width = (GridLength)gridLength; // Grid.SetColumn(label, index); // break; // case GridDefinitions.Row: // grid.RowDefinitions.Add(new RowDefinition()); // if (gridLength != null) // grid.RowDefinitions[index].Height = (GridLength)gridLength; // Grid.SetRow(label, index); // break; //} //grid.Children.Add(label); }