//private void increaseSize_Click(object sender, RoutedEventArgs e) //{ // object fontSize = TextEditing.GetRTBValue(TextElement.FontSizeProperty); // if (fontSize != DependencyProperty.UnsetValue) // { // fontSizeBox.IsTextSearchEnabled = true; // fontSizeBox.Text = Converter.PointToPixel((double)(fontSize)).ToString(); // fontSizeBox.IsTextSearchEnabled = false; // } // else // { // fontSizeBox.Text = ""; // fontSizeBox.SelectedIndex = -1; // } //} //private void decreaseSize_Click(object sender, RoutedEventArgs e) //{ // object fontSize = TextEditing.GetRTBValue(TextElement.FontSizeProperty); // if (fontSize != DependencyProperty.UnsetValue) // { // fontSizeBox.IsTextSearchEnabled = true; // fontSizeBox.Text = Converter.PointToPixel((double)(fontSize)).ToString(); // fontSizeBox.IsTextSearchEnabled = false; // } // else // { // fontSizeBox.Text = ""; // fontSizeBox.SelectedIndex = -1; // } //} private void UpdateFontSize(bool focusRTB) { string text = fontSizeBox.Text; double value; if (double.TryParse(text, out value)) { TextEditing.SetRTBValue(FontSizeProperty, Converter.PixelToPoint(value), focusRTB); bool found = false; foreach (ComboBoxItem each in fontSizeBox.Items) { if (each.Content.ToString() == text) { each.IsSelected = true; found = true; break; } } if (!found) { fontSizeBox.SelectedIndex = -1; fontSizeBox.Text = text; } } }
private void fontFamilyBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0 && fontFamilyBox.SelectedItem != null) { TextEditing.SetRTBValue(FontFamilyProperty, fontFamilyBox.SelectedItem.ToString(), true); } }
private void fontSizeBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) { string newSize = (fontSizeBox.SelectedItem as ComboBoxItem).Content as string; double value; if (double.TryParse(newSize, out value)) { TextEditing.SetRTBValue(FontSizeProperty, Converter.PixelToPoint(value), true); } } }
private void paragraphSpacingBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count > 0) { object fontSize = TextEditing.GetRTBValue(FontSizeProperty); if (fontSize == DependencyProperty.UnsetValue) { fontSize = SpellChecking.FocusedRTB.FontSize; } TextEditing.SetRTBValue(Paragraph.MarginProperty, new Thickness(0, 0, 0, (double.Parse((e.AddedItems[0] as ComboBoxItem).Content.ToString()) - 1) * (double)fontSize), true); } }
private void UpdateFontFamily(bool focusRTB) { string text = fontFamilyBox.Text; TextEditing.SetRTBValue(FontFamilyProperty, text, focusRTB); bool found = false; for (int i = 0; i < fontFamilyBox.Items.Count; i++) { if (fontFamilyBox.Items[i].ToString() == text) { fontFamilyBox.SelectedIndex = i; found = true; break; } } if (!found) { fontFamilyBox.SelectedIndex = -1; fontFamilyBox.Text = text; } }
private void borderType_OnSelectedChangedEvent(object sender, EventArgs e) { TextEditing.SetRTBValue(Block.BorderThicknessProperty, borderType.SelectedBorder, true); }
private void highlightColor_OnSelectedChangedEvent(object sender, EventArgs e) { TextEditing.SetRTBValue(TextElement.BackgroundProperty, highlightColor.SelectedColor, true); }
private void fontColor_OnSelectedChangedEvent(object sender, EventArgs e) { TextEditing.SetRTBValue(ForegroundProperty, fontColor.SelectedColor, true); }