//Color Picker Colour OnColour Changed Method
 private void ColorPicker_ColorChanged(object sender, Windows.UI.Color color)
 {
     Windows.UI.Text.ITextSelection selectedText = editBox.Document.Selection;
     if (selectedText != null)
     {
         Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
         charFormatting.ForegroundColor = color;
     }
 }
Example #2
0
 private void ItalicButton_Click(object sender, RoutedEventArgs e)
 {
     Windows.UI.Text.ITextSelection selectedText = editor.Document.Selection;
     if (selectedText != null)
     {
         Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
         charFormatting.Italic        = Windows.UI.Text.FormatEffect.Toggle;
         selectedText.CharacterFormat = charFormatting;
     }
 }
Example #3
0
 private void SetFontSize(int size)
 {
     Windows.UI.Text.ITextSelection selectedText = editor.Document.Selection;
     if (selectedText != null)
     {
         Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
         charFormatting.Size          = size;
         selectedText.CharacterFormat = charFormatting;
     }
 }
Example #4
0
 private void SubScriptClicked(object sender, PointerRoutedEventArgs e)
 {
     Windows.UI.Text.ITextSelection selectedText = TxtArea.Document.Selection;
     if (selectedText != null)
     {
         Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
         charFormatting.Subscript     = Windows.UI.Text.FormatEffect.Toggle;
         selectedText.CharacterFormat = charFormatting;
     }
 }
Example #5
0
 private void ItalicButton_Click(object sender, RoutedEventArgs e)
 {
     Windows.UI.Text.ITextSelection selectedText = editor.Document.Selection; //check for selected text, either highlighted or a point
     if (selectedText != null)                                                //should be != null in most cases
     {
         Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
         charFormatting.Italic        = Windows.UI.Text.FormatEffect.Toggle;//toggle italics
         selectedText.CharacterFormat = charFormatting;
     }
 }
Example #6
0
 private void ChangeColor()
 {
     // Apply the color to the selected text in a RichEditBox.
     Windows.UI.Text.ITextSelection selectedText = richEdit.Document.Selection;
     if (selectedText != null)
     {
         Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
         charFormatting.ForegroundColor = _currentColorBrush.Color;
         selectedText.CharacterFormat   = charFormatting;
     }
 }
Example #7
0
 /// <summary>
 /// Underlines the specified selected text.
 /// </summary>
 /// <param name="selectedText">The selected text.</param>
 public void Underline(Windows.UI.Text.ITextSelection selectedText)
 {
     Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
     if (charFormatting.Underline == Windows.UI.Text.UnderlineType.None)
     {
         charFormatting.Underline = Windows.UI.Text.UnderlineType.Single;
     }
     else
     {
         charFormatting.Underline = Windows.UI.Text.UnderlineType.None;
     }
     selectedText.CharacterFormat = charFormatting;
 }
Example #8
0
 private void UnderlineButton_Click(object sender, RoutedEventArgs e)
 {
     Windows.UI.Text.ITextSelection selectedText = editor.Document.Selection;
     if (selectedText != null)
     {
         Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
         if (charFormatting.Underline == Windows.UI.Text.UnderlineType.None)
         {
             charFormatting.Underline = Windows.UI.Text.UnderlineType.Single;
         }
         else
         {
             charFormatting.Underline = Windows.UI.Text.UnderlineType.None;
         }
         selectedText.CharacterFormat = charFormatting;
     }
 }
 //ALLCAPS Button
 private void allCapsbtn_Click(object sender, RoutedEventArgs e)
 {
     Windows.UI.Text.ITextSelection selectedText = editBox.Document.Selection;
     if (selectedText != null)
     {
         Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
         if (charFormatting.AllCaps == Windows.UI.Text.FormatEffect.Off)
         {
             charFormatting.AllCaps = Windows.UI.Text.FormatEffect.On;
         }
         else
         {
             charFormatting.AllCaps = Windows.UI.Text.FormatEffect.Off;
         }
         selectedText.CharacterFormat = charFormatting;
     }
 }
Example #10
0
 private void HighlightButton_Click(object sender, RoutedEventArgs e)
 {
     Windows.UI.Text.ITextSelection selectedText = editor.Document.Selection;
     if (selectedText != null)
     {
         Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
         if (charFormatting.BackgroundColor == Windows.UI.Colors.White)  //Check if unhighlighted
         {
             charFormatting.BackgroundColor = Windows.UI.Colors.Yellow;  //highlight
         }
         else                                                            //oh but it was already highlight
         {
             charFormatting.BackgroundColor = Windows.UI.Colors.White;   //too bad so sad
         }
         selectedText.CharacterFormat = charFormatting;
     }
 }
Example #11
0
 /// <summary>
 /// Italics the text selected.
 /// </summary>
 /// <param name="selectedText">The selected text.</param>
 public void ItalicBtnClicked(Windows.UI.Text.ITextSelection selectedText)
 {
     Windows.UI.Text.ITextCharacterFormat charFormatting = selectedText.CharacterFormat;
     charFormatting.Italic        = Windows.UI.Text.FormatEffect.Toggle;
     selectedText.CharacterFormat = charFormatting;
 }