public void Refresh() { if (tabControl.SelectorVisibility != System.Windows.Visibility.Visible) { return; } if (tabControl.Direction == eDirection.Bottom || tabControl.Direction == eDirection.Top) { SelectorHeight = tabControl.SelectorLength; SelectorWidth = double.NaN; } else { SelectorHeight = double.NaN; SelectorWidth = tabControl.SelectorLength; } if (tabControl.SelectorReverse && tabControl.Direction == eDirection.Top) { VerticalAlignment = System.Windows.VerticalAlignment.Bottom; HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; } else if (!tabControl.SelectorReverse && tabControl.Direction == eDirection.Top) { VerticalAlignment = System.Windows.VerticalAlignment.Top; HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; } else if (tabControl.SelectorReverse && tabControl.Direction == eDirection.Bottom) { VerticalAlignment = System.Windows.VerticalAlignment.Top; HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; } else if (!tabControl.SelectorReverse && tabControl.Direction == eDirection.Bottom) { VerticalAlignment = System.Windows.VerticalAlignment.Bottom; HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch; } else if (tabControl.SelectorReverse && tabControl.Direction == eDirection.Left) { VerticalAlignment = System.Windows.VerticalAlignment.Stretch; HorizontalAlignment = System.Windows.HorizontalAlignment.Right; } else if (!tabControl.SelectorReverse && tabControl.Direction == eDirection.Left) { VerticalAlignment = System.Windows.VerticalAlignment.Stretch; HorizontalAlignment = System.Windows.HorizontalAlignment.Left; } else if (tabControl.SelectorReverse && tabControl.Direction == eDirection.Right) { VerticalAlignment = System.Windows.VerticalAlignment.Stretch; HorizontalAlignment = System.Windows.HorizontalAlignment.Left; } else if (!tabControl.SelectorReverse && tabControl.Direction == eDirection.Right) { VerticalAlignment = System.Windows.VerticalAlignment.Stretch; HorizontalAlignment = System.Windows.HorizontalAlignment.Right; } }
/// <summary> /// Creates a new vertical progress bar. /// </summary> /// <param name="width">Width of the control.</param> /// <param name="height">Height of the control.</param> /// <param name="verticalAlignment">Sets the control to be vertical, starting from the specified side. Center/Stretch is invalid.</param> /// <exception cref="InvalidOperationException">Thrown when <paramref name="verticalAlignment"/> is set to either <see cref="System.Windows.VerticalAlignment.Center"/> or <see cref="System.Windows.VerticalAlignment.Stretch"/>.</exception> public ProgressBar(int width, int height, System.Windows.VerticalAlignment verticalAlignment) : base(width, height) { if (verticalAlignment == System.Windows.VerticalAlignment.Center || verticalAlignment == System.Windows.VerticalAlignment.Stretch) { throw new InvalidOperationException("VerticalAlignment.Center or VerticalAlignment.Stretch is invalid for the progress bar control."); } this.verticalAlignment = verticalAlignment; isHorizontal = false; controlSize = height; CanFocus = false; TabStop = false; DetermineAppearance(); }
public static Model.Scene2D.VerticalAlignment ToD2DVerticalAlignment(this System.Windows.VerticalAlignment v) { switch (v) { case System.Windows.VerticalAlignment.Center: return(Model.Scene2D.VerticalAlignment.Center); case System.Windows.VerticalAlignment.Top: return(Model.Scene2D.VerticalAlignment.Top); case System.Windows.VerticalAlignment.Bottom: return(Model.Scene2D.VerticalAlignment.Bottom); case System.Windows.VerticalAlignment.Stretch: return(Model.Scene2D.VerticalAlignment.Stretch); default: return(Model.Scene2D.VerticalAlignment.Center); } }
public Image(RegionOptions options) : base(options) { this.filePath = options.uri; this.scaleType = options.Dictionary.Get("scaleType", "stretch"); // Horizontal Alignment switch (options.Dictionary.Get("align", "center")) { case "left": hAlign = System.Windows.HorizontalAlignment.Left; break; case "right": hAlign = System.Windows.HorizontalAlignment.Right; break; default: hAlign = System.Windows.HorizontalAlignment.Center; break; } // Vertical Alignment switch (options.Dictionary.Get("valign", "middle")) { case "top": this.vAlign = System.Windows.VerticalAlignment.Top; break; case "bottom": this.vAlign = System.Windows.VerticalAlignment.Bottom; break; default: this.vAlign = System.Windows.VerticalAlignment.Center; break; } }