C# Class eCollegeWP7.Views.Controls.DynamicTextBlock

A simple text control that truncates the text to ellipses when there is insufficient room to display all of the text.
Inheritance: System.Windows.Controls.ContentControl
Datei anzeigen Open project: PearsonLearningStudio/mobile2-windows7

Public Properties

Property Type Description
LineHeightProperty System.Windows.DependencyProperty
LineStackingStrategyProperty System.Windows.DependencyProperty
TextProperty System.Windows.DependencyProperty
TextStyleProperty System.Windows.DependencyProperty
TextWrappingProperty System.Windows.DependencyProperty

Public Methods

Method Description
DynamicTextBlock ( ) : System

Initializes a new instance of the DynamicTextBlock class

Protected Methods

Method Description
GetDesiredText ( string sourceText, int min, int max, Size availableSize, Size unboundSize, bool wrapping ) : string
MeasureOverride ( Size availableSize ) : Size

Handles the measure part of the measure and arrange layout process. During this process we measure the textBlock that we've created as content with increasingly smaller amounts of text until we find text that fits.

OnLineHeightChanged ( System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnLineStackingStrategyChanged ( System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnTextChanged ( System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnTextWrappingChanged ( System.Windows.DependencyPropertyChangedEventArgs e ) : void
ReduceText ( string text ) : string

Reduces the length of the text. Derived classes can override this to use different techniques for reducing the text length.

Private Methods

Method Description
OnLineHeightChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnLineStackingStrategyChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnTextChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnTextStyleChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void
OnTextWrappingChanged ( DependencyObject d, System.Windows.DependencyPropertyChangedEventArgs e ) : void

Method Details

DynamicTextBlock() public method

Initializes a new instance of the DynamicTextBlock class
public DynamicTextBlock ( ) : System
return System

GetDesiredText() protected method

protected GetDesiredText ( string sourceText, int min, int max, Size availableSize, Size unboundSize, bool wrapping ) : string
sourceText string
min int
max int
availableSize System.Windows.Size
unboundSize System.Windows.Size
wrapping bool
return string

MeasureOverride() protected method

Handles the measure part of the measure and arrange layout process. During this process we measure the textBlock that we've created as content with increasingly smaller amounts of text until we find text that fits.
protected MeasureOverride ( Size availableSize ) : Size
availableSize System.Windows.Size the available size
return System.Windows.Size

OnLineHeightChanged() protected method

protected OnLineHeightChanged ( System.Windows.DependencyPropertyChangedEventArgs e ) : void
e System.Windows.DependencyPropertyChangedEventArgs
return void

OnLineStackingStrategyChanged() protected method

protected OnLineStackingStrategyChanged ( System.Windows.DependencyPropertyChangedEventArgs e ) : void
e System.Windows.DependencyPropertyChangedEventArgs
return void

OnTextChanged() protected method

protected OnTextChanged ( System.Windows.DependencyPropertyChangedEventArgs e ) : void
e System.Windows.DependencyPropertyChangedEventArgs
return void

OnTextWrappingChanged() protected method

protected OnTextWrappingChanged ( System.Windows.DependencyPropertyChangedEventArgs e ) : void
e System.Windows.DependencyPropertyChangedEventArgs
return void

ReduceText() protected method

Reduces the length of the text. Derived classes can override this to use different techniques for reducing the text length.
protected ReduceText ( string text ) : string
text string the original text
return string

Property Details

LineHeightProperty public_oe static_oe property

public static DependencyProperty,System.Windows LineHeightProperty
return System.Windows.DependencyProperty

LineStackingStrategyProperty public_oe static_oe property

public static DependencyProperty,System.Windows LineStackingStrategyProperty
return System.Windows.DependencyProperty

TextProperty public_oe static_oe property

public static DependencyProperty,System.Windows TextProperty
return System.Windows.DependencyProperty

TextStyleProperty public_oe static_oe property

public static DependencyProperty,System.Windows TextStyleProperty
return System.Windows.DependencyProperty

TextWrappingProperty public_oe static_oe property

public static DependencyProperty,System.Windows TextWrappingProperty
return System.Windows.DependencyProperty