@ -17,11 +17,11 @@ namespace Microsoft.Windows.Controls
#region RichTextBox
public static readonly DependencyProperty Rich Tex tBox Property = DependencyProperty . Register ( "Rich Tex tBox " , typeof ( global :: System . Windows . Controls . RichTextBox ) , typeof ( RichTextBoxFormatBar ) , new PropertyMetadata ( null , new PropertyChangedCallback ( OnRichTextBoxPropertyChanged ) ) ) ;
public global :: System . Windows . Controls . RichTextBox Rich Tex tBox
public static readonly DependencyProperty Targ etProperty = DependencyProperty . Register ( "Targ et" , typeof ( global :: System . Windows . Controls . RichTextBox ) , typeof ( RichTextBoxFormatBar ) , new PropertyMetadata ( null , OnRichTextBoxPropertyChanged ) ) ;
public global :: System . Windows . Controls . RichTextBox Targ et
{
get { return ( global :: System . Windows . Controls . RichTextBox ) GetValue ( Rich Tex tBox Property) ; }
set { SetValue ( Rich Tex tBox Property, value ) ; }
get { return ( global :: System . Windows . Controls . RichTextBox ) GetValue ( Targ etProperty ) ; }
set { SetValue ( Targ etProperty , value ) ; }
}
private static void OnRichTextBoxPropertyChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
@ -32,12 +32,12 @@ namespace Microsoft.Windows.Controls
private void HookupRichTextBoxEvents ( )
{
Rich Tex tBox . SelectionChanged + = RichTextBox_SelectionChanged ;
Targ et . SelectionChanged + = RichTextBox_SelectionChanged ;
}
#endregion //RichTextBox
public double [ ] FontSizes
public static double [ ] FontSizes
{
get
{
@ -67,7 +67,7 @@ namespace Microsoft.Windows.Controls
void FormatToolbar_Loaded ( object sender , RoutedEventArgs e )
{
_ cmbFontFamilies . ItemsSource = System . Windows . Media . Fonts . SystemFontFamilies ;
_ cmbFontFamilies . ItemsSource = Fonts . SystemFontFamilies ;
_ cmbFontSizes . ItemsSource = FontSizes ;
}
@ -122,13 +122,13 @@ namespace Microsoft.Windows.Controls
void UpdateItemCheckedState ( ToggleButton button , DependencyProperty formattingProperty , object expectedValue )
{
object currentValue = Rich Tex tBox . Selection . GetPropertyValue ( formattingProperty ) ;
object currentValue = Targ et . Selection . GetPropertyValue ( formattingProperty ) ;
button . IsChecked = ( currentValue = = DependencyProperty . UnsetValue ) ? false : currentValue ! = null & & currentValue . Equals ( expectedValue ) ;
}
private void UpdateSelectedFontFamily ( )
{
object value = Rich Tex tBox . Selection . GetPropertyValue ( TextElement . FontFamilyProperty ) ;
object value = Targ et . Selection . GetPropertyValue ( TextElement . FontFamilyProperty ) ;
FontFamily currentFontFamily = ( FontFamily ) ( ( value = = DependencyProperty . UnsetValue ) ? null : value ) ;
if ( currentFontFamily ! = null )
{
@ -138,7 +138,7 @@ namespace Microsoft.Windows.Controls
private void UpdateSelectedFontSize ( )
{
object value = Rich Tex tBox . Selection . GetPropertyValue ( TextElement . FontSizeProperty ) ;
object value = Targ et . Selection . GetPropertyValue ( TextElement . FontSizeProperty ) ;
_ cmbFontSizes . SelectedValue = ( value = = DependencyProperty . UnsetValue ) ? null : value ;
}
@ -147,13 +147,13 @@ namespace Microsoft.Windows.Controls
if ( value = = null )
return ;
Rich Tex tBox . Selection . ApplyPropertyValue ( formattingProperty , value ) ;
Targ et . Selection . ApplyPropertyValue ( formattingProperty , value ) ;
}
private void ProcessMove ( DragDeltaEventArgs e )
{
AdornerLayer layer = AdornerLayer . GetAdornerLayer ( Rich Tex tBox ) ;
UIElementAdorner < Control > adorner = layer . GetAdorners ( Rich Tex tBox ) [ 0 ] as UIElementAdorner < Control > ;
AdornerLayer layer = AdornerLayer . GetAdornerLayer ( Targ et ) ;
UIElementAdorner < Control > adorner = layer . GetAdorners ( Targ et ) [ 0 ] as UIElementAdorner < Control > ;
adorner . SetOffsets ( adorner . OffsetLeft + e . HorizontalChange , adorner . OffsetTop + e . VerticalChange ) ;
}