But if i am typing more than 1 letter or number in the Font Familiy Box or Size Box , the dialog remains open and overwrites the selected text which i'm trying to change the font properties of.
Are there any properties to avoid this ?! or is this a real bug??
Comments: ** Comment from web user: BoucherS **
As a workaround, you could use the following (for the FontSize) :
In the "RichTextBoxFormatBar.cs" file :
1) in the "FontSize_SelectionChanged" method :
replace
ApplyPropertyValueToSelectedText( TextElement.FontSizeProperty, e.AddedItems[ 0 ] );
with
if( _cmbFontSizes.IsDropDownOpen )
ApplyPropertyValueToSelectedText( TextElement.FontSizeProperty, e.AddedItems[ 0 ] );
2) in the "OnApplyTemplate" method :
Add
_cmbFontSizes.KeyUp += new System.Windows.Input.KeyEventHandler( FontSize_KeyUp );
(don't forget to unregister)
3) the "fontSize_KeyUp" method would be :
private void FontSize_KeyUp( object sender, System.Windows.Input.KeyEventArgs e )
{
if( e.Key == System.Windows.Input.Key.Enter )
{
ApplyPropertyValueToSelectedText( TextElement.FontSizeProperty, _cmbFontSizes.SelectedValue );
}
}