public void PlaceGroupElementUnderCursor(IUIElement groupElement) { for (int i = 0; i < 2; i++) { PlaceGroupElementUnderCursor(groupElement, i); } }
public void SnapToGroupElement(IUIElement groupElement) { for (int i = 0; i < 2; i++) { SnapToGroupElement(groupElement, i); } }
public void ComponentCtor(IUIElement owner, ButtonEventDispatcher ownerEventDispatcher) { _owner = (IUIInteractiveElement) owner; ownerEventDispatcher.OnLeftButtonPress.Add(this); ownerEventDispatcher.OnLeftButtonRelease.Add(this); ownerEventDispatcher.OnMouseScroll.Add(this); }
public Rect GetCellBoundsFor(IUIElement uiElement, double xOffset, double yOffset) { int firstColumn = uiElement.GridColumn().Clamp(0, _columns.Length - 1); int columnSpan = uiElement.GridColumnSpan().Clamp(1, _columns.Length - firstColumn); int lastColumn = firstColumn + columnSpan; int firstRow = uiElement.GridRow().Clamp(0, _rows.Length - 1); int rowSpan = uiElement.GridRowSpan().Clamp(1, _rows.Length - firstRow); int lastRow = firstRow + rowSpan; double top = TopEdgeOfRow(firstRow); double left = LeftEdgeOfColumn(firstColumn); double width = 0; double height = 0; for (int n = firstColumn; n < lastColumn; n++) { width += _columns[n].Size; } for (int n = firstRow; n < lastRow; n++) { height += _rows[n].Size; } // Account for any space between spanned rows/columns width += (columnSpan - 1) * _columnSpacing; height += (rowSpan - 1) * _rowSpacing; return(new Rect(left + xOffset, top + yOffset, width, height)); }
private static void RemoveCommand(Command command, IUIElement element) { Debug.Assert(command != null, "Expected a valid command"); Debug.Assert(element != null, "Expected a valid element"); if (cmdElements.ContainsKey(command)) { command.Changed -= new EventHandler(OnCommandChanged); } else { Debug.Fail("The specified command does not exist."); } List <Command> commands; if (elementCommands.TryGetValue(element, out commands) == true) { commands.Remove(command); if (commands.Count == 0) { elementCommands.Remove(element); } } else { Debug.Fail("The specified element does not exist in the command elements table."); } }
public void DeselectElement(IUIElement deselected) { if (selectedElement != null && selectedElement.Equals(deselected)) { selectedElement = null; } }
public void UpadateProcess_Demo(float initDeltaPosOnAxis, float deceleration, int dimension, Vector2 elementInitLocalPos) { IInertialScrollProcessConstArg arg = CreateMockConstArg(); arg.processManager.GetInertialScrollDeceleration().Returns(deceleration); arg.initialVelocity.Returns(initDeltaPosOnAxis); arg.dimension.Returns(dimension); IUIElement scrollerElement = Substitute.For <IUIElement>(); scrollerElement.GetLocalPosition().Returns(elementInitLocalPos); arg.scrollerElement.Returns(scrollerElement); TestInertialScrollProcess process = new TestInertialScrollProcess(arg); bool done = false; DebugHelper.PrintInRed("initVel: " + initDeltaPosOnAxis.ToString() + ", deceleration: " + deceleration.ToString()); float deltaT = .1f; Vector2 localPos = elementInitLocalPos; scrollerElement.SetLocalPosition(Arg.Do <Vector2>(x => localPos = x)); while (!done) { process.UpdateProcess(deltaT); Debug.Log("elementLocalPos: " + localPos.ToString() + ", velocity: " + process.thisPrevVelocity_Test.ToString()); if (process.thisElapsedTime_Test >= process.thisExpireTime_Test) { done = true; } } }
public UIElement(IUIElement @base) : this((IObjectIdInMemory)@base) { Region = (@base?.Region ?? RectInt.Empty); InTreeIndex = @base?.InTreeIndex; ChildLastInTreeIndex = @base?.ChildLastInTreeIndex; }
/// <summary> /// Check to see which part of the UI is clicked. /// </summary> /// <param name="x">mouse x</param> /// <param name="y">mouse y</param> /// <returns></returns> private IUIElement ClickedObject(int x, int y) { for (int i = 0; i < Toolbars.Count; i++) { if (x > Toolbars[i].X && x <Toolbars[i].X + Toolbars[i].Width && y> Toolbars[i].Y && y < Toolbars[i].Y + Toolbars[i].Height) { IUIElement iuie = Toolbars[0].GetButton(x, y); return(iuie); } } for (int i = 0; i < WindowElements.Count; i++) { if (x > WindowElements[i].X && x <WindowElements[i].X + WindowElements[i].Width && y> WindowElements[i].Y && y < WindowElements[i].Y + WindowElements[i].Height) { MoveWindowToTop(WindowElements[i]); IUIElement iuie = WindowElements[0].GetButton(x, y); if (iuie != null) { return(iuie); } return(WindowElements[0]); } } System.Diagnostics.Debug.WriteLine("WARNING! ClickedObject return null."); return(null); }
public ShipUiIndication(IUIElement raw) : base(raw) { ManeuverType = LabelText?.OrderBy(label => label.RegionCenter()?.B)?.FirstOrDefault()?.Text?.ManeuverTypeFromShipUiIndicationText(); }
IUIElement GetCorrectedGroupElementCorrectedForBounds(IUIElement source) { int sourceIndex = thisUIElementGroup.GetGroupElementIndex(source); int correctedIndex = GetCursoredGroupElementIndexCorrectedForBounds(sourceIndex); return(thisUIElementGroup.GetGroupElement(correctedIndex)); }
protected void SnapToGroupElement(IUIElement groupElement, float initialVelocity, int dimension) { IUIElement targetGroupElement = GetCorrectedGroupElementCorrectedForBounds(groupElement); float targetNormalizedCursoredPosition = GetNormalizedCursoredPositionFromGroupElementToCursor(targetGroupElement, dimension); SnapTo(targetNormalizedCursoredPosition, initialVelocity, dimension); }
private bool MenuOpenOnRootPossible() { var memoryMeasurement = Bot?.MemoryMeasurementAtTime?.Value; var menu = memoryMeasurement?.Menu?.FirstOrDefault(); if (null == menu) { return(false); } var overviewEntry = RootUIElement as Sanderling.Parse.IOverviewEntry; IUIElement regionExpected = RootUIElement; if (null != overviewEntry) { regionExpected = memoryMeasurement?.WindowOverview?.FirstOrDefault(); if (!(overviewEntry.IsSelected ?? false)) { return(false); } if (!(menu?.Entry?.Any(menuEntry => menuEntry?.Text?.RegexMatchSuccessIgnoreCase(@"remove.*overview") ?? false) ?? false)) { return(false); } } //if (regionExpected.Region.Intersection(menu.Region.WithSizeExpandedPivotAtCenter(10)).IsEmpty()) // return false; return(true); }
private static void AddCommand(Command command, IUIElement element) { Debug.Assert(command != null, "Expected a valid command"); Debug.Assert(element != null, "Expected a valid element"); List <IUIElement> elements; if (cmdElements.TryGetValue(command, out elements) == false) { command.Changed += new EventHandler(OnCommandChanged); elements = new List <IUIElement>(); cmdElements.Add(command, elements); } elements.Add(element); List <Command> commands; if (elementCommands.TryGetValue(element, out commands) == false) { commands = new List <Command>(); elementCommands.Add(element, commands); } commands.Add(command); }
static public ISerializableBotTask DoubleClickTask(this IUIElement element) { return(new BotTask("Double click on " + element) { ClientActions = new[] { element.MouseDoubleClick(MouseButtonIdEnum.Left).AsRecommendation() } }); }
public IUIElement Show(IUIElement ui, params object[] args) { ui.OnSetup(args); if (ui.State == UIState.Hidden) { #if DEBUG_UI //Debug.Log("ShowUI: " + ui); #endif ui.PlayShownSound(); ui.OnWillShow(); _connector.Show(ui); ui.State = UIState.Show; ui.OnShown(); return(ui); } return(ui); }
public void SetPage <T>(bool hideAll = false, object[] data = null) where T : IUIElement { if (hideAll) { foreach (var _page in _uiPages) { _page.Hide(); } } else { if (CurrentPage != null) { CurrentPage.Hide(); } } foreach (var _page in _uiPages) { if (_page is T) { CurrentPage = _page; break; } } if (CurrentPage != null) { CurrentPage.Show(data); } else { Debug.LogError("CurrentPage == null"); } }
protected static Size ArrangeOverrideVertical(IStackBase stack, Size finalSize) { //var padding = Stack.Padding; //double top = padding.Top + bounds.Top; //double left = padding.Left + bounds.Left; //var height = bounds.Height - padding.VerticalThickness; var children = stack.Children; int count = children.Count; double width = finalSize.Width; double spacing = stack.Spacing; double stackHeight = 0; for (int n = 0; n < count; n++) { IUIElement child = children[n]; if (!child.Visible) { continue; } double childHeight = child.DesiredSize.Height; child.Arrange(new Rect(0, stackHeight, width, childHeight)); stackHeight += childHeight + spacing; } return(AdjustForStretchToFill(stack, width, stackHeight, finalSize)); }
public override void SetUpReference() { base.SetUpReference(); IUIElement rootUIElement = rootUIAdaptor.GetUIElement(); thisManager.SetRootUIElement(rootUIElement); }
public T Calculate() { IUIElement uieToExamine = thisUIElementToExamine; while (true) { IUIElement parentUIE = uieToExamine.GetParentUIE(); if (parentUIE != null) { if (parentUIE is T) { return((T)parentUIE); } else { uieToExamine = parentUIE; } } else { break; } } return(null); }
protected void SetUpScrollerElementAndCursor() { IUIElement element = GetScrollerElement(); thisScroller.SetUpScrollerElementAndCursor(element); cursorRectIsReady = true; }
string GetCursorOffsetString() { IUIElementGroupScroller uieGroupScroller = (IUIElementGroupScroller)uieGroupScrollerAdaptor.GetUIElement(); if (uieGroupScroller != null) { IUIElement scrollerElement = uieGroupScroller.GetScrollerElement(); Vector2 offset = new Vector2(); for (int i = 0; i < 2; i++) { float cursorOffset = uieGroupScroller.GetElementCursorOffsetInPixel( scrollerElement.GetLocalPosition()[i], i ); offset[i] = cursorOffset; } string result = "Cursored Offset: ( " + offset.x + ", " + offset.y + " )"; return(result); } return(""); }
public int Calculate(int sourceIndex) { IUIElement sourceElement = thisUIElementGroup.GetGroupElement(sourceIndex); int columnCount = thisUIElementGroup.GetArraySize(0); int rowCount = thisUIElementGroup.GetArraySize(1); int[] arraySize = new int[] { columnCount, rowCount }; int[] arrayIndex = thisUIElementGroup.GetGroupElementArrayIndex(sourceElement); int[] targetArrayIndex = new int[2]; for (int i = 0; i < 2; i++) { targetArrayIndex[i] = arrayIndex[i]; if (arrayIndex[i] > arraySize[i] - thisCursorSize[i]) { targetArrayIndex[i] = arraySize[i] - thisCursorSize[i]; } } IUIElement targetInitElement = thisUIElementGroup.GetGroupElement(targetArrayIndex[0], targetArrayIndex[1]); int targetIndex = thisUIElementGroup.GetGroupElementIndex(targetInitElement); return(targetIndex); }
public static IUIElement WithRegion(this IUIElement @base, RectInt region) { return((@base == null) ? null : new UIElement(@base) { Region = region }); }
/// <summary> /// 设置工具栏按钮的界面元素值 /// </summary> /// <param name="Tsb"></param> /// <param name="UIE"></param> protected void SetToolStripComboBoxValue(object ControlObj, IUIElement UIE) { ToolStripComboBox Tsb = (ToolStripComboBox)ControlObj; if (UIE != null) { Tsb.Visible = UIE.IsVisible(); Tsb.Enabled = UIE.IsEnabled(); } int selectindex = -1; foreach (object obj in Tsb.Items) { IToolsItem tt = obj as IToolsItem; if (tt != null) { if (tt.UIElement != null) { if (tt.UIElement.IsActive()) { selectindex = Tsb.Items.IndexOf(obj); } } } } if (selectindex != -1 && Tsb.DroppedDown == false) { Tsb.SelectedIndex = selectindex; } }
protected override Vector2 GetInitialNormalizedCursoredPosition() { int correctedInitiallyCursoredGroupElementIndex = GetCursoredGroupElementIndexCorrectedForBounds(thisInitiallyCursoredGroupElementIndex); IUIElement initiallyCursoredGroupElement = thisUIElementGroup.GetGroupElement(correctedInitiallyCursoredGroupElementIndex); return(GetNormalizedCursoredPositionFromGroupElementToCursor(initiallyCursoredGroupElement)); }
public static IUIElement SetSize(this IUIElement element, Vector2 newSize) { var oldBounds = element.GetBounds(); element.SetBounds(new RectangleF(oldBounds.X, oldBounds.Y, newSize.X, newSize.Y)); return(element); }
public static IUIElement SetPosition(this IUIElement element, Vector2 newPosition) { var oldBounds = element.GetBounds(); element.SetBounds(new RectangleF(newPosition.X, newPosition.Y, oldBounds.Width, oldBounds.Height)); return(element); }
/// <summary> /// Invoked to unhook an object from the command adapter. /// </summary> /// <param name="invoker">Object whose event will be unhooked</param> /// <param name="eventName">Name of the event to unhook</param> public override void RemoveInvoker(object invoker, string eventName) { Guard.ArgumentNotNull(invoker, "invoker"); Guard.ArgumentNotNullOrEmptyString(eventName, "eventName"); ThrowIfWrongType(invoker); // get the specific invoker TInvoker specificInvoker = (TInvoker)invoker; if (this.invoker != specificInvoker) { throw new InvalidOperationException(Properties.Resources.DifferentInvoker); } // unhook the event of the cached invoker this.UnhookEvent(this.eventSource, eventName); // unregister the invoker key & command adapter CommandAdapterManager.UnregisterAdapter(this, this.logicalInvoker); // release all references regarding the invoker and the events this.eventName = null; this.invoker = null; this.eventSource = null; this.logicalInvoker = null; }
public Size MeasureOverrideHorizontal(IStackBase stack, Size constraint) { //var padding = panelStack.Padding; double measuredWidth = 0; double measuredHeight = 0; IUICollection <IUIElement> children = stack.Children; int count = stack.Children.Count; for (int i = 0; i < count; i++) { IUIElement child = children[i]; if (!child.Visible) { continue; } child.Measure(new Size(double.PositiveInfinity, constraint.Height)); var desiredSize = child.DesiredSize; measuredWidth += desiredSize.Width; measuredHeight = Math.Max(measuredHeight, desiredSize.Height); } measuredWidth += MeasureTotalSpacing(stack); //measuredWidth += padding.HorizontalThickness; //measuredHeight += padding.VerticalThickness; var finalWidth = ResolveWidthConstraints(stack, constraint.Width, measuredWidth); var finalHeight = ResolveHeightConstraints(stack, constraint.Height, measuredHeight); return(new Size(finalWidth, finalHeight)); }
public void Calculate_Various( int sourceIndex, int[] arraySize, int[] sourceElementArrayIndex, int[] cursorSize, int[] expectedArrayIndex, int expectedIndex ) { IUIElement sourceElement = Substitute.For <IUIElement>(); IUIElementGroup uieGroup = Substitute.For <IUIElementGroup>(); uieGroup.GetGroupElement(sourceIndex).Returns(sourceElement); uieGroup.GetArraySize(0).Returns(arraySize[0]); uieGroup.GetArraySize(1).Returns(arraySize[1]); uieGroup.GetGroupElementArrayIndex(sourceElement).Returns(sourceElementArrayIndex); IUIElement expectedMock = Substitute.For <IUIElement>(); uieGroup.GetGroupElement(expectedArrayIndex[0], expectedArrayIndex[1]).Returns(expectedMock); uieGroup.GetGroupElementIndex(expectedMock).Returns(expectedIndex); ICorrectedCursoredElementIndexCalculator calculator = new CorrectedCursoredElementIndexCalculator(uieGroup, cursorSize); int actual = calculator.Calculate(sourceIndex); Assert.That(actual, Is.EqualTo(expectedIndex)); }
/// <summary> /// Gets the focused <see cref="UIElement"/>, if any, within the specified focus scope /// </summary> /// <param name="focusScope">The <see cref="IUIElement"/> that represents the scope within which to find the focused element</param> /// <returns>A <see cref="UIElement"/> representing the focused element of the specified focus scope</returns> public static UIElement GetFocusedElement(IUIElement focusScope) { if (!focusScope.DependencyProperties.ContainsKey(FocusManager.FocusedElementProperty)) { return null; } return focusScope.GetValue<UIElement>(FocusManager.FocusedElementProperty); }
public InSpaceBracket(IUIElement @base) : base(@base) { var BaseSpec = @base as IInSpaceBracket; Name = BaseSpec?.Name; }
/// <summary> /// Sets a boolean indicating whether or not the specified <see cref="IUIElement"/> is a focus scope element /// </summary> /// <param name="element">The <see cref="IUIElement"/> to set</param> /// <param name="isFocusScope">A boolean indicating whether or not the specified <see cref="IUIElement"/> is a focus scope element</param> public static void SetIsFocusScope(IUIElement element, bool isFocusScope) { if (!element.DependencyProperties.ContainsKey(FocusManager.IsFocusScopeProperty)) { FocusManager.AppendFocusProperties(element); } element.SetValue(FocusManager.IsFocusScopeProperty, isFocusScope); }
/// <summary> /// Gets a boolean indicating whether or not the specified <see cref="IUIElement"/> is a focus scope element /// </summary> /// <param name="element">The <see cref="IUIElement"/> to check</param> /// <returns>A boolean indicating whether or not the specified <see cref="IUIElement"/> is a focus scope element</returns> public static bool GetIsFocusScope(IUIElement element) { if (!element.DependencyProperties.ContainsKey(FocusManager.IsFocusScopeProperty)) { return false; } return element.GetValue<bool>(FocusManager.IsFocusScopeProperty); }
static public MotionResult MouseMove( this IHostToScript Host, IUIElement Destination, MouseButtonIdEnum[] MouseButton = null) => Host?.MotionExecute(new Motor.MotionParam() { MouseListWaypoint = new[] { new Motor.MotionParamMouseRegion() { UIElement = Destination }, }, MouseButton = MouseButton, });
public Scroll(IScroll @base) : this((IUIElement)@base) { ColumnHeader = @base?.ColumnHeader; Clipper = @base?.Clipper; ScrollHandleBound = @base?.ScrollHandleBound; ScrollHandle = @base?.ScrollHandle; }
public void ComponentCtor(IUIElement owner, ButtonEventDispatcher ownerEventDispatcher) { _owner = (IUIInteractiveElement) owner; _Enabled = true; _isMoving = false; ownerEventDispatcher.OnLeftButtonPress.Add(this); ownerEventDispatcher.OnLeftButtonRelease.Add(this); ownerEventDispatcher.OnMouseMovement.Add(this); }
public ValidationFieldHandler(IUIElement uiElement, string validationFiled, IValidationContainer validationContainer) { this.uiElement = uiElement; this.validationFiled = validationFiled; this.validationContainer = validationContainer; validationContainer.ValidationSourceChanged += OnValidationSourceChanged; validationContainer.ValidationEnabledChanged += OnValidationEnabledChanged; SetValidationSourceHandler(); Debug.WriteLine(string.Format("Validation Handler constructed. validaton source: {0}, field {1} ", validationSource, uiElement)); }
static public MotionResult MouseDragAndDrop( this IHostToScript Host, IUIElement ElementToDrag, IUIElement Destination, MouseButtonIdEnum MouseButton) => Host?.MotionExecute(new Motor.MotionParam() { MouseListWaypoint = new[] { ElementToDrag, Destination }.Select(UIElement => new Motor.MotionParamMouseRegion() { UIElement = UIElement })?.ToArray(), MouseButton = new[] { MouseButton }, });
public Window(IUIElement Base) : base(Base) { var BaseAsWindow = Base as IWindow; isModal = BaseAsWindow?.isModal; Caption = BaseAsWindow?.Caption; HeaderButtonsVisible = BaseAsWindow?.HeaderButtonsVisible; HeaderButton = BaseAsWindow?.HeaderButton; }
public Container(IUIElement @base) : base(@base) { var BaseAsContainer = @base as IContainer; ButtonText = BaseAsContainer?.ButtonText; LabelText = BaseAsContainer?.LabelText; InputText = BaseAsContainer?.InputText; Sprite = BaseAsContainer?.Sprite; }
public void Navigate(object navObject) { _normalMode.EnterNormalMode(); _history.Push(new History(navObject, 0)); _navObject = navObject; _mainStack.Children.Clear(); _activeElement = _container.Get<IUIElementFactory>().GetUIElement(navObject); _activeElement.Render(_stackPanelWrapper); }
/// <summary> /// Sets the focused <see cref="UIElement"/> within the specified focus scope /// </summary> /// <param name="focusScope">The <see cref="IUIElement"/> that represents the scope for which to set the focused element</param> /// <param name="focusedElement">The <see cref="UIElement"/> to set the focus to</param> public static void SetFocusedElement(IUIElement focusScope, UIElement focusedElement) { UIElement toUnfocus; if (!focusScope.DependencyProperties.ContainsKey(FocusManager.FocusedElementProperty)) { FocusManager.AppendFocusProperties(focusScope); } toUnfocus = focusScope.GetValue<UIElement>(FocusManager.FocusedElementProperty); if(toUnfocus != null) { toUnfocus.Unfocus(); } focusScope.SetValue(FocusManager.FocusedElementProperty, focusedElement); focusedElement.Focus(); }
/// <summary> /// Returns a <see cref="Media.Rectangle"/> that represents the layout partition that is reserved for a child element<para></para> /// It is equivalent to the rectangle returned by the <see cref="IUIElement.RenderTarget"/> property, modified to include eventual padding values /// </summary> /// <param name="element">The <see cref="IUIElement"/> instance to compute the layout slot of</param> /// <returns>A <see cref="Media.Rectangle"/> that represents the layout partition that is reserved for a child element</returns> public static Media.Rectangle GetLayoutSlot(IUIElement element) { IPaddedElement paddedElement; Media.Point layoutSlotPosition; Media.Size layoutSlotSize; Media.Rectangle layoutSlot; layoutSlotPosition = element.RenderTarget.Position; layoutSlotSize = element.RenderTarget.Size; if (typeof(IPaddedElement).IsAssignableFrom(element.GetType())) { paddedElement = (IPaddedElement)element; layoutSlotPosition += new Media.Point(paddedElement.Padding.Left, paddedElement.Padding.Top); layoutSlotSize = new Media.Size(layoutSlotSize.Width - paddedElement.Padding.Left - paddedElement.Padding.Right, layoutSlotSize.Height - paddedElement.Padding.Top - paddedElement.Padding.Bottom ); } layoutSlot = new Media.Rectangle(layoutSlotPosition, layoutSlotSize); return layoutSlot; }
public void ComponentCtor(IUIElement owner, ButtonEventDispatcher ownerEventDispatcher){ _owner = owner; _ownerEventDispatcher = ownerEventDispatcher; if (_defaultState == FadeState.Faded){ _owner.Opacity = _fadeoutOpacity; } switch (_fadeTrigger){ case FadeTrigger.EntryExit: if (!(_owner is IUIInteractiveElement)){ throw new Exception("Invalid fade trigger: Unable to set an interactive trigger to a non-interactive element."); } ownerEventDispatcher.OnMouseEntry.Add(this); ownerEventDispatcher.OnMouseExit.Add(this); //((IUIInteractiveElement) _owner).OnLeftButtonRelease.Add(ConfirmFadeoutProc);what the f**k was this for break; case FadeTrigger.None: break; } }
public SelectionAdorner(IUIElement adornedElement, ICanvasItem canvasItem) : base((UIElement) adornedElement.GetCoreInstance(), canvasItem) { }
protected CanvasItemAdorner(IUIElement adornedElement, ICanvasItem canvasItem) { AdornedElement = adornedElement; CanvasItem = canvasItem; }
/// <summary> /// This method is used to append all the <see cref="DependencyProperty"/> required by the <see cref="FocusManager"/> /// </summary> /// <param name="element">The <see cref="UIElement"/> to which to append the <see cref="DependencyProperty"/> to</param> internal static void AppendFocusProperties(IUIElement element) { HashSet<UIElement> observables; if (!element.DependencyProperties.ContainsKey(FocusManager.IsFocusScopeProperty)) { element.DependencyProperties.Add(FocusManager.IsFocusScopeProperty, null); } if (!element.DependencyProperties.ContainsKey(FocusManager.FocusedElementProperty)) { element.DependencyProperties.Add(FocusManager.FocusedElementProperty, null); } if (!element.DependencyProperties.ContainsKey(FocusManager.FocusableElementsProperty)) { observables = new HashSet<UIElement>(); element.DependencyProperties.Add(FocusManager.FocusableElementsProperty, observables); } }
/// <summary> /// Gets a list of all the focusable <see cref="UIElement"/> contained within the specified focus scope /// </summary> /// <param name="focusScope">The focus scope <see cref="IUIElement"/></param> /// <returns>A list of all the focusable <see cref="UIElement"/> contained within the specified focus scope</returns> public static HashSet<UIElement> GetFocusableElements(IUIElement focusScope) { if (!focusScope.DependencyProperties.ContainsKey(FocusManager.FocusableElementsProperty)) { return null; } return focusScope.GetValue<HashSet<UIElement>>(FocusManager.FocusableElementsProperty); }
public TreeViewEntry(IUIElement Base) : base(Base) { }
public Neocom(IUIElement Base) : base(Base) { }
public MarketItemTypeDetailsMarketData(IUIElement @base) : base(@base) { }
public Menu(IUIElement Base) : base(Base) { }
/// <summary> /// Sets the focus to the next focusable <see cref="UIElement"/> available /// </summary> /// <param name="focusScope">The <see cref="IUIElement"/> within which to navigate</param> public static void NavigateToNextElement(IUIElement focusScope) { IEnumerable<UIElement> focusables; UIElement focusedElement; int focusedElementIndex; if (!FocusManager.GetIsFocusScope(focusScope)) { return; } focusables = FocusManager.GetFocusableElements(focusScope); focusables = focusables.Where(f => f.GetValue<bool>(KeyboardNavigation.IsTabStopProperty)).OrderBy(f => f.GetValue<int>(KeyboardNavigation.TabIndexProperty)); focusedElement = FocusManager.GetFocusedElement(focusScope); if(focusedElement == null) { focusedElement = focusables.First(); } else { focusedElementIndex = focusables.ToList().IndexOf(focusedElement); if(focusedElementIndex + 1 < focusables.Count()) { focusedElementIndex++; focusedElement = focusables.ElementAt(focusedElementIndex); } } FocusManager.SetFocusedElement(focusScope, focusedElement); }
public MenuEntry(IUIElement Base) : base(Base) { }
public TreeViewEntry(IUIElement @base) : base(@base) { }
void OnChoosePort(IUIElement e) { string p = null; if (portMapping.TryGetValue(e, out p)) HOBD.config.Port = p; if (ChoosePortAction != null) ChoosePortAction(); }
void OnBluetoothScan(IUIElement e) { if (discoverBThread == null){ discoverBThread = new Thread(this.DiscoverBT); discoverBThread.Start(); } }
public Scroll(IUIElement @base) : base(@base) { }