A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

91 lines
6.1 KiB

<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:ControlCatalog.Controls"
x:Class="ControlCatalog.Pages.TextBoxFontsPage">
<ScrollViewer Padding="24,20,24,28">
<StackPanel Spacing="16">
<controls:SampleSection Header="Embedded font faces"
Description="A FontFamily can point at a folder of font files with an avares URI, and FontWeight and FontStyle then choose the face; it can also name a single file when only one face is wanted."
StageMinHeight="220">
<StackPanel Spacing="8" HorizontalAlignment="Left">
<TextBox Width="300"
Text="Custom font regular"
FontWeight="Normal"
FontStyle="Normal"
FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro" />
<TextBox Width="300"
Text="Custom font bold"
FontWeight="Bold"
FontStyle="Normal"
FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro" />
<TextBox Width="300"
Text="Custom font italic"
FontWeight="Normal"
FontStyle="Italic"
FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro" />
<TextBox Width="300"
Text="Custom font bold italic"
FontWeight="Bold"
FontStyle="Italic"
FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro" />
<TextBox Width="300"
Text="One face straight from one file"
FontFamily="/Assets/Fonts/SourceSansPro-Italic.ttf#Source Sans Pro" />
</StackPanel>
<controls:SampleSection.Code><x:String xml:space="preserve"><![CDATA[<TextBox FontWeight="Bold"
FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro" />
<TextBox FontFamily="/Assets/Fonts/SourceSansPro-Italic.ttf#Source Sans Pro" />]]></x:String></controls:SampleSection.Code>
</controls:SampleSection>
<controls:SampleSection Header="Font size and the input method"
Description="An input method places its candidate window from the caret rectangle, which follows the font size of the box. InputMethod.IsInputMethodEnabled turns the input method off for a box that should take raw key input."
StageMinHeight="190">
<StackPanel Spacing="12" HorizontalAlignment="Left">
<StackPanel Spacing="4">
<TextBlock Classes="sample-caption" Text="FontSize 10" />
<TextBox Width="300"
FontSize="10"
Text="Small font, candidate window sits close to the line"
FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro" />
</StackPanel>
<StackPanel Spacing="4">
<TextBlock Classes="sample-caption" Text="FontSize 22" />
<TextBox Width="300"
FontSize="22"
Text="Large font"
FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro" />
</StackPanel>
<StackPanel Spacing="4">
<TextBlock Classes="sample-caption" Text="InputMethod.IsInputMethodEnabled=&quot;False&quot;" />
<TextBox Width="300"
InputMethod.IsInputMethodEnabled="False"
Text="Input method disabled"
FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro" />
</StackPanel>
</StackPanel>
<controls:SampleSection.Code><x:String xml:space="preserve"><![CDATA[<TextBox InputMethod.IsInputMethodEnabled="False" />]]></x:String></controls:SampleSection.Code>
</controls:SampleSection>
<controls:SampleSection Header="Complex scripts"
Description="Editing, selection and caret movement work the same for scripts that shape and for scripts that run right to left. FlowDirection puts the caret and the text alignment on the other side."
StageMinHeight="260">
<StackPanel Spacing="12" HorizontalAlignment="Left">
<TextBox MaxWidth="440"
AcceptsReturn="True"
TextWrapping="Wrap"
MinLines="7"
MaxLines="12"
FontFamily="avares://ControlCatalog/Assets/Fonts#WenQuanYi Micro Hei"
Text="计算机科学(是系统性研究信息与计算的理论基础以及它们在计算机系统中如何实现与应用的实用技术的学科。它通常被形容为对那些创造、描述以及转换信息的算法处理的系统研究。计算机科学包含很多分支领域;有些强调特定结果的计算,比如计算机图形学;而有些是探討计算问题的性质,比如计算复杂性理论;还有一些领域專注于怎样实现计算,比如程式語言理論是研究描述计算的方法,而程式设计是应用特定的程式語言解决特定的计算问题,人机交互则是專注于怎样使计算机和计算变得有用、好用,以及随时随地为人所用。&#xD;&#xD;有时公众会误以为计算机科学就是解决计算机问题的事业(比如信息技术),或者只是与使用计算机的经验有关,如玩游戏、上网或者文字处理。其实计算机科学所关注的,不仅仅是去理解实现类似游戏、浏览器这些软件的程序的性质,更要通过现有的知识创造新的程序或者改进已有的程序。" />
<TextBox Width="300"
FlowDirection="RightToLeft"
Text="مرحبا بالعالم، هذا نص من اليمين إلى اليسار." />
</StackPanel>
<controls:SampleSection.Code><x:String xml:space="preserve"><![CDATA[<TextBox FlowDirection="RightToLeft" Text="..." />]]></x:String></controls:SampleSection.Code>
</controls:SampleSection>
</StackPanel>
</ScrollViewer>
</UserControl>