File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TextToolbar Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 77using Microsoft . Toolkit . Uwp . UI . Controls ;
88using Microsoft . Toolkit . Uwp . UI . Controls . TextToolbarButtons ;
99using Microsoft . Toolkit . Uwp . UI . Controls . TextToolbarFormats . MarkDown ;
10+ using Microsoft . Toolkit . Uwp . UI . Controls . TextToolbarFormats . RichText ;
1011using Microsoft . Toolkit . Uwp . UI . Extensions ;
1112using Windows . System ;
1213using Windows . UI . Xaml ;
@@ -57,6 +58,16 @@ private void Load()
5758 AddCustomButton ( ) ;
5859 } ) ;
5960
61+ SampleController . Current . RegisterNewCommand ( "Use RichText Formatter" , ( sender , args ) =>
62+ {
63+ UseRichTextFormatter ( ) ;
64+ } ) ;
65+
66+ SampleController . Current . RegisterNewCommand ( "Use MarkDown Formatter" , ( sender , args ) =>
67+ {
68+ UseMarkDownFormatter ( ) ;
69+ } ) ;
70+
6071 SampleController . Current . RegisterNewCommand ( "Use Custom Formatter" , ( sender , args ) =>
6172 {
6273 UseCustomFormatter ( ) ;
@@ -88,6 +99,28 @@ private void ResetLayout()
8899 }
89100 }
90101
102+ private void UseRichTextFormatter ( )
103+ {
104+ if ( _toolbar == null )
105+ {
106+ return ;
107+ }
108+
109+ var formatter = new RichTextFormatter ( ) ;
110+ _toolbar . Formatter = formatter ;
111+ }
112+
113+ private void UseMarkDownFormatter ( )
114+ {
115+ if ( _toolbar == null )
116+ {
117+ return ;
118+ }
119+
120+ var formatter = new MarkDownFormatter ( ) ;
121+ _toolbar . Formatter = formatter ;
122+ }
123+
91124 private void UseCustomFormatter ( )
92125 {
93126 if ( _toolbar == null )
You can’t perform that action at this time.
0 commit comments