Search Results for

    Show / Hide Table of Contents

    Class TextControl

    Attached behavior that supports dynamic text highlighting for controls derived from TextBlock or RichTextBox.

    Inheritance
    Object
    DispatcherObject
    DependencyObject
    TextControl
    Inherited Members
    DependencyObject.ClearValue(DependencyProperty)
    DependencyObject.ClearValue(DependencyPropertyKey)
    DependencyObject.CoerceValue(DependencyProperty)
    DependencyObject.Equals(Object)
    DependencyObject.GetHashCode()
    DependencyObject.GetLocalValueEnumerator()
    DependencyObject.GetValue(DependencyProperty)
    DependencyObject.InvalidateProperty(DependencyProperty)
    DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs)
    DependencyObject.ReadLocalValue(DependencyProperty)
    DependencyObject.SetCurrentValue(DependencyProperty, Object)
    DependencyObject.SetValue(DependencyProperty, Object)
    DependencyObject.SetValue(DependencyPropertyKey, Object)
    DependencyObject.ShouldSerializeProperty(DependencyProperty)
    DependencyObject.DependencyObjectType
    DependencyObject.IsSealed
    DispatcherObject.Dispatcher
    Object.Equals(Object, Object)
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: BionicCode.Utilities.Net
    Assembly: BionicCode.Utilities.Net.Wpf.dll
    Syntax
    public class TextControl : DependencyObject

    Fields

    | Improve this Doc View Source

    HighlightBackgroundProperty

    Attached property to define the background Brush for the highlight text, which is defined by HighlightRange items contained in the HighlightRangesProperty attached property.

    Declaration
    public static readonly DependencyProperty HighlightBackgroundProperty
    Field Value
    Type Description
    DependencyProperty
    | Improve this Doc View Source

    HighlightForegroundProperty

    Attached property to define the foreground Brush for the highlight text, which is defined by HighlightRange items contained in the HighlightRangesProperty attached property.

    Declaration
    public static readonly DependencyProperty HighlightForegroundProperty
    Field Value
    Type Description
    DependencyProperty
    | Improve this Doc View Source

    HighlightRangesProperty

    Attached property to define a HighlightRangeCollection of HighlightRange items. cref="HighlightRangesProperty"/> attached property.

    Declaration
    public static readonly DependencyProperty HighlightRangesProperty
    Field Value
    Type Description
    DependencyProperty
    Remarks

    This collection implements INotifyCollectionChanged.

    | Improve this Doc View Source

    IsHighlightingEnabledProperty

    Attached property to enable or disable the highlight attached behavior TextControl. cref="HighlightRangesProperty"/> attached property.

    Declaration
    public static readonly DependencyProperty IsHighlightingEnabledProperty
    Field Value
    Type Description
    DependencyProperty
    | Improve this Doc View Source

    TextProperty

    Attached property to serve as alternative text property for the RichTextBox (instead of using Document). Optional property to use with TextBlock (instead of Text). The defined HighlightRange items contained in the attached property HighlightRangesProperty collection will always be applied to Text and the TextProperty values.

    Declaration
    public static readonly DependencyProperty TextProperty
    Field Value
    Type Description
    DependencyProperty
    Remarks

    In case of the TextProperty being attached to a RichTextBox, the string value will be converted to a FlowDocument and assigned to the Document property.

    Methods

    | Improve this Doc View Source

    GetHighlightBackground(DependencyObject)

    Get method of the attached property HighlightBackgroundProperty.

    Declaration
    public static Brush GetHighlightBackground(DependencyObject attachingElement)
    Parameters
    Type Name Description
    DependencyObject attachingElement

    The attaching TextBlock or RichTextBox.

    Returns
    Type Description
    Brush

    The Brush for the background of the highlight text ranges.

    | Improve this Doc View Source

    GetHighlightForeground(DependencyObject)

    Get method of the attached property HighlightForegroundProperty.

    Declaration
    public static Brush GetHighlightForeground(DependencyObject attachingElement)
    Parameters
    Type Name Description
    DependencyObject attachingElement

    The attaching TextBlock or RichTextBox.

    Returns
    Type Description
    Brush

    The Brush for the foreground of the highlight text ranges.

    | Improve this Doc View Source

    GetHighlightRanges(DependencyObject)

    Get method of the attached property HighlightRangesProperty.

    Declaration
    public static HighlightRangeCollection GetHighlightRanges(DependencyObject attachingElement)
    Parameters
    Type Name Description
    DependencyObject attachingElement

    The attaching TextBlock or RichTextBox.

    Returns
    Type Description
    HighlightRangeCollection

    A HighlightRangeCollection.

    | Improve this Doc View Source

    GetIsHighlightingEnabled(DependencyObject)

    Get method of the attached property HighlightForegroundProperty.

    Declaration
    public static bool GetIsHighlightingEnabled(DependencyObject attachingElement)
    Parameters
    Type Name Description
    DependencyObject attachingElement

    The attaching TextBlock or RichTextBox.

    Returns
    Type Description
    Boolean

    true if the the attached TextControl behavior is enabled or false if it is disabled.

    | Improve this Doc View Source

    GetText(DependencyObject)

    Get method of the attached property TextProperty.

    Declaration
    public static string GetText(DependencyObject attachingElement)
    Parameters
    Type Name Description
    DependencyObject attachingElement

    The attaching TextBlock or RichTextBox.

    Returns
    Type Description
    String

    The current text value.

    | Improve this Doc View Source

    SetHighlightBackground(DependencyObject, Brush)

    Set method of attached property HighlightBackgroundProperty.

    Declaration
    public static void SetHighlightBackground(DependencyObject attachingElement, Brush value)
    Parameters
    Type Name Description
    DependencyObject attachingElement

    The attaching TextBlock or RichTextBox.

    Brush value

    The Brush for the background of the highlight text ranges.

    | Improve this Doc View Source

    SetHighlightForeground(DependencyObject, Brush)

    Set method of attached property HighlightForegroundProperty.

    Declaration
    public static void SetHighlightForeground(DependencyObject attachingElement, Brush value)
    Parameters
    Type Name Description
    DependencyObject attachingElement

    The attaching TextBlock or RichTextBox.

    Brush value

    The Brush for the foreground of the highlight text ranges.

    | Improve this Doc View Source

    SetHighlightRanges(DependencyObject, HighlightRangeCollection)

    Set method of attached property HighlightRangesProperty.

    Declaration
    public static void SetHighlightRanges(DependencyObject attachingElement, HighlightRangeCollection value)
    Parameters
    Type Name Description
    DependencyObject attachingElement

    The attaching TextBlock or RichTextBox.

    HighlightRangeCollection value

    A HighlightRangeCollection.

    | Improve this Doc View Source

    SetIsHighlightingEnabled(DependencyObject, Boolean)

    Set method of attached property IsHighlightingEnabledProperty.

    Declaration
    public static void SetIsHighlightingEnabled(DependencyObject attachingElement, bool value)
    Parameters
    Type Name Description
    DependencyObject attachingElement

    The attaching TextBlock or RichTextBox.

    Boolean value

    true to enable the attached TextControl behavior or false to disable it.

    | Improve this Doc View Source

    SetText(DependencyObject, String)

    Set method of attached property TextProperty.

    Declaration
    public static void SetText(DependencyObject attachingElement, string value)
    Parameters
    Type Name Description
    DependencyObject attachingElement

    The attaching TextBlock or RichTextBox.

    String value

    The text to display.

    Extension Methods

    HelperExtensionsCommon.ToDictionary(Object)
    HelperExtensionsCommon.ToFlatDictionary(Object)
    HelperExtensions.TryFindVisualParentElement<TParent>(DependencyObject, out TParent)
    HelperExtensions.TryFindVisualParentElementByName<TChild>(DependencyObject, String, out TChild)
    HelperExtensions.TryFindVisualChildElement<TChild>(DependencyObject, out TChild)
    HelperExtensions.TryFindVisualChildElementByName<TChild>(DependencyObject, String, out TChild)
    HelperExtensions.EnumerateVisualChildElements<TChildren>(DependencyObject)

    See Also

    See advanced example
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX