TextBoxPage.xaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. x:Class="ControlCatalog.Pages.TextBoxPage"
  4. xmlns:sys="clr-namespace:System;assembly=netstandard">
  5. <StackPanel Orientation="Vertical" Spacing="4">
  6. <Label Classes="h1">TextBox</Label>
  7. <Label Classes="h2">A control into which the user can input text</Label>
  8. <StackPanel Orientation="Horizontal"
  9. Margin="0,16,0,0"
  10. HorizontalAlignment="Center"
  11. Spacing="16">
  12. <StackPanel Orientation="Vertical" Spacing="8">
  13. <TextBox Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit." Width="200" />
  14. <TextBox Width="200" Watermark="ReadOnly" IsReadOnly="True" Text="This is read only"/>
  15. <TextBox Width="200" Watermark="Numeric Watermark" x:Name="numericWatermark"/>
  16. <TextBox Width="200"
  17. Watermark="Floating Watermark"
  18. UseFloatingWatermark="True"
  19. Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit."/>
  20. <MaskedTextBox Width="200" ResetOnSpace="False" Mask="(LLL) 999-0000"/>
  21. <TextBox Width="200" Text="Validation Error">
  22. <DataValidationErrors.Error>
  23. <sys:Exception />
  24. </DataValidationErrors.Error>
  25. </TextBox>
  26. <TextBox Width="200"
  27. Watermark="Password Box"
  28. Classes="revealPasswordButton"
  29. UseFloatingWatermark="True"
  30. PasswordChar="*"
  31. Text="Password" />
  32. <TextBox Width="200" Text="Left aligned text" TextAlignment="Left" />
  33. <TextBox Width="200" Text="Center aligned text" TextAlignment="Center" />
  34. <TextBox Width="200" Text="Right aligned text" TextAlignment="Right" />
  35. <TextBox Width="200" Text="Custom selection brush"
  36. SelectionStart="5" SelectionEnd="22"
  37. SelectionBrush="Green" SelectionForegroundBrush="Yellow"/>
  38. <TextBox Width="200" Text="Custom caret brush" CaretBrush="DarkOrange"/>
  39. </StackPanel>
  40. <StackPanel Orientation="Vertical" Spacing="8">
  41. <TextBox AcceptsReturn="True" TextWrapping="Wrap" Width="200" Height="125"
  42. Text="Multiline TextBox with TextWrapping.&#xD;&#xD;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." />
  43. <TextBox AcceptsReturn="True" Width="200" Height="125"
  44. Text="Multiline TextBox with no TextWrapping.&#xD;&#xD;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est." />
  45. <TextBox Classes="clearButton" Text="Clear Content" Width="200" FontWeight="Normal" FontStyle="Normal" Watermark="Watermark" FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro"/>
  46. </StackPanel>
  47. <StackPanel Orientation="Vertical" Spacing="8">
  48. <Label Classes="h2" Target="{Binding #firstResMFont}">res_m fonts</Label>
  49. <TextBox Width="200" x:Name="firstResMFont" Text="Custom font regular" FontWeight="Normal" FontStyle="Normal" FontFamily="resm:ControlCatalog.Assets.Fonts?assembly=ControlCatalog#Source Sans Pro"/>
  50. <TextBox Width="200" Text="Custom font bold" FontWeight="Bold" FontStyle="Normal" FontFamily="resm:ControlCatalog.Assets.Fonts?assembly=ControlCatalog#Source Sans Pro"/>
  51. <TextBox Width="200" Text="Custom font italic" FontWeight="Normal" FontStyle="Italic" FontFamily="resm:ControlCatalog.Assets.Fonts.SourceSansPro-Italic.ttf?assembly=ControlCatalog#Source Sans Pro"/>
  52. <TextBox Width="200" Text="Custom font italic bold" FontWeight="Bold" FontStyle="Italic" FontFamily="resm:ControlCatalog.Assets.Fonts.SourceSansPro-*.ttf?assembly=ControlCatalog#Source Sans Pro"/>
  53. </StackPanel>
  54. <StackPanel Orientation="Vertical" Spacing="8">
  55. <Label Classes="h2" Target="{Binding #firstResFont}">_res fonts</Label>
  56. <TextBox Width="200" x:Name="firstResFont" Text="Custom font regular" FontWeight="Normal" FontStyle="Normal" FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro"/>
  57. <TextBox Width="200" Text="Custom font bold" FontWeight="Bold" FontStyle="Normal" FontFamily="avares://ControlCatalog/Assets/Fonts#Source Sans Pro"/>
  58. <TextBox Width="200" Text="Custom font italic" FontWeight="Normal" FontStyle="Italic" FontFamily="/Assets/Fonts/SourceSansPro-Italic.ttf#Source Sans Pro"/>
  59. <TextBox Width="200" Text="Custom font italic bold" FontWeight="Bold" FontStyle="Italic" FontFamily="/Assets/Fonts/SourceSansPro-*.ttf#Source Sans Pro"/>
  60. </StackPanel>
  61. </StackPanel>
  62. <TextBox AcceptsReturn="True" TextWrapping="Wrap" Height="200" MaxWidth="400"
  63. FontFamily="avares://ControlCatalog/Assets/Fonts#WenQuanYi Micro Hei"
  64. Text="计算机科学(是系统性研究信息与计算的理论基础以及它们在计算机系统中如何实现与应用的实用技术的学科。它通常被形容为对那些创造、描述以及转换信息的算法处理的系统研究。计算机科学包含很多分支领域;有些强调特定结果的计算,比如计算机图形学;而有些是探討计算问题的性质,比如计算复杂性理论;还有一些领域專注于怎样实现计算,比如程式語言理論是研究描述计算的方法,而程式设计是应用特定的程式語言解决特定的计算问题,人机交互则是專注于怎样使计算机和计算变得有用、好用,以及随时随地为人所用。&#xD;&#xD;有时公众会误以为计算机科学就是解决计算机问题的事业(比如信息技术),或者只是与使用计算机的经验有关,如玩游戏、上网或者文字处理。其实计算机科学所关注的,不仅仅是去理解实现类似游戏、浏览器这些软件的程序的性质,更要通过现有的知识创造新的程序或者改进已有的程序。" />
  65. </StackPanel>
  66. </UserControl>