public GetPropertyValue ( DependencyProperty formattingProperty ) : object | ||
formattingProperty | DependencyProperty | |
return | object |
public FontTypefaceHandler(swd.TextSelection range, sw.Controls.RichTextBox control) { var family = range.GetPropertyValue(swd.TextElement.FontFamilyProperty) as swm.FontFamily ?? swd.TextElement.GetFontFamily(control); var style = range.GetPropertyValue(swd.TextElement.FontStyleProperty) as sw.FontStyle? ?? swd.TextElement.GetFontStyle(control); var weight = range.GetPropertyValue(swd.TextElement.FontWeightProperty) as sw.FontWeight? ?? swd.TextElement.GetFontWeight(control); var stretch = range.GetPropertyValue(swd.TextElement.FontStretchProperty) as sw.FontStretch? ?? swd.TextElement.GetFontStretch(control); Control = new swm.Typeface(family, style, weight, stretch); }
public FontHandler(swd.TextSelection range, sw.FrameworkElement control) { var wpfFamily = range.GetPropertyValue(swd.TextElement.FontFamilyProperty) as swm.FontFamily ?? swd.TextElement.GetFontFamily(control); this.Family = new FontFamily(new FontFamilyHandler(wpfFamily)); this.Size = PixelsToPoints(range.GetPropertyValue(swd.TextElement.FontSizeProperty) as double? ?? swd.TextElement.GetFontSize(control), control); this.WpfFontStyle = range.GetPropertyValue(swd.TextElement.FontStyleProperty) as sw.FontStyle? ?? swd.TextElement.GetFontStyle(control); this.WpfFontWeight = range.GetPropertyValue(swd.TextElement.FontWeightProperty) as sw.FontWeight? ?? swd.TextElement.GetFontWeight(control); var decorations = range.GetPropertyValue(swd.Inline.TextDecorationsProperty) as sw.TextDecorationCollection; if (decorations != null) { this.WpfTextDecorations = new sw.TextDecorationCollection(decorations); } }
public FontFamilyHandler(swd.TextSelection range, sw.Controls.RichTextBox control) { Control = range.GetPropertyValue(swd.TextElement.FontFamilyProperty) as swm.FontFamily ?? swd.TextElement.GetFontFamily(control); var familyMapName = Control.FamilyNames.Select(r => r.Value).FirstOrDefault(); Name = familyMapName ?? Control.Source; }
//listo bool swEstáEnNegrita(TextSelection texto) { if ((FontWeight)texto.GetPropertyValue(Run.FontWeightProperty) == FontWeights.Bold) return true; else return false; }
private void GetTextProperties(TextSelection ts) { var size = ts.GetPropertyValue(Inline.FontSizeProperty); if (size != DependencyProperty.UnsetValue) { fontsize.Text = size.ToString(); } var font = ts.GetPropertyValue(Inline.FontFamilyProperty); if (font != DependencyProperty.UnsetValue) { Font.SelectedIndex = Font.Items.IndexOf(font); } var bold = ts.GetPropertyValue(Inline.FontWeightProperty); if (bold != DependencyProperty.UnsetValue) { if ((FontWeight)bold == FontWeights.Bold) { btnBold.IsChecked = true; } else { btnBold.IsChecked = false; } } var td = ts.GetPropertyValue(Inline.TextDecorationsProperty); if (td != DependencyProperty.UnsetValue && td is TextDecorationCollection) { foreach (TextDecoration tdec in (TextDecorationCollection)td) { if (tdec == TextDecorations.Underline[0]) btnUnderLine.IsChecked = true; else btnUnderLine.IsChecked = false ; } } else btnUnderLine.IsChecked = false; var italic = ts.GetPropertyValue(Inline.FontStyleProperty); if (italic != DependencyProperty.UnsetValue) { if ((FontStyle)italic == FontStyles.Italic) { btnItalic.IsChecked = true; } else { btnItalic.IsChecked = false; } } var colorValue = ts.GetPropertyValue(Inline.ForegroundProperty); if (colorValue != DependencyProperty.UnsetValue) { SolidColorBrush b = (SolidColorBrush)colorValue; color.SelectedColor = b.Color; } }