private protected bool IsCaretOnText(out ILayoutStringContentFocus textCellFocus) { textCellFocus = null; if (Focus is ILayoutStringContentFocus AsTextFocus) { bool IsHandled = false; switch (AsTextFocus.CellView.Frame) { case ILayoutCharacterFrame AsCharacterFrame: IsHandled = true; // The focus was displayed directly with the character. break; case ILayoutNumberFrame AsNumberFrame: case ILayoutTextValueFrame AsTextValueFrame: textCellFocus = AsTextFocus; IsHandled = true; break; } Debug.Assert(IsHandled); } return(textCellFocus != null); }
private protected void DrawTextCaret(ILayoutStringContentFocus textCellFocus) { ILayoutStringContentFocusableCellView CellView = textCellFocus.CellView; Node Node = CellView.StateView.State.Node; string PropertyName = CellView.PropertyName; string Text = NodeTreeHelper.GetString(Node, PropertyName); Point CellOrigin = CellView.CellOrigin; Padding CellPadding = CellView.CellPadding; Point OriginWithPadding = CellOrigin.Moved(CellPadding.Left, CellPadding.Top); DrawContext.ShowCaret(OriginWithPadding, Text, FocusedTextStyle, ActualCaretMode, CaretPosition); }