From ccf6addeb1556acabc43b372b7bb5a3f39c48ec4 Mon Sep 17 00:00:00 2001 From: Yoojun Zhou Date: Tue, 7 Jan 2025 17:50:38 +0800 Subject: [PATCH] Example code for TextBlock --- .../Pages/Controls/Windows/TextBlockPage.xaml | 54 +++---------------- .../Controls/Windows/TextBlockPage.xaml.cs | 32 +++++++++++ 2 files changed, 40 insertions(+), 46 deletions(-) diff --git a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TextBlockPage.xaml b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TextBlockPage.xaml index 9ecee8e..1b9df5a 100644 --- a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TextBlockPage.xaml +++ b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TextBlockPage.xaml @@ -21,46 +21,18 @@ - - - <TextBlock Text="I am a TextBlock"/> - - - - -<Page.Resources> - <Style TargetType="TextBlock" x:Key="CustomTextBlockStyle"> - <Setter Property="FontFamily" Value="Comic Sans MS"/> - <Setter Property="FontStyle" Value="Italic"/> - </Style> -<Page.Resources> - -<TextBlock Text="I am a styled TextBlock" Style="{StaticResource CustomTextBlockStyle}"/> - - - + - - -<TextBlock Text="I am super excited to be here!" FontFamily="Arial" - FontSize="24" FontStyle="Italic" TextWrapping="WrapWholeWords" - CharacterSpacing="200" Foreground="CornflowerBlue" /> - - @@ -68,22 +40,12 @@ Text in a TextBlock doesn't have to be a simple string. - Text can bebold - ,italic - , orunderlined - . + Text can bebold, + italic, + orunderlined. + + - - -<TextBlock> - <Run FontFamily="Times New Roman" Foreground="DarkGray"> - Text in a TextBlock doesn't have to be a simple string.</Run> - <LineBreak/> - <Span>Text can be <Bold>bold</Bold>, - <Italic>italic</Italic>, or <Underline>underlined</Underline>. </Span> -</TextBlock> - - diff --git a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TextBlockPage.xaml.cs b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TextBlockPage.xaml.cs index 1e09fe1..6732066 100644 --- a/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TextBlockPage.xaml.cs +++ b/source/iNKORE.UI.WPF.Modern.Gallery/Pages/Controls/Windows/TextBlockPage.xaml.cs @@ -23,15 +23,47 @@ public partial class TextBlockPage : Page public TextBlockPage() { InitializeComponent(); + UpdateExampleCode(); } #region Example Code public void UpdateExampleCode() { + if (!this.IsInitialized) return; + Example1.Xaml = Example1Xaml; + Example2.Xaml = Example2Xaml; + Example3.Xaml = Example3Xaml; + Example4.Xaml = Example4Xaml; } + public string Example1Xaml => $@" + +"; + + public string Example2Xaml => $@" + +"; + + public string Example3Xaml => $@" + +"; + + public string Example4Xaml => $@" + + Text in a TextBlock doesn't have to be a simple string. + + + Text can bebold, + italic, + orunderlined. + + +"; + #endregion }