MainWindow.axaml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <Window xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:local="clr-namespace:TextTestApp"
  4. x:Class="TextTestApp.MainWindow"
  5. Title="Text Test App" Width="700" Height="700">
  6. <DockPanel>
  7. <Border DockPanel.Dock="Bottom" Background="WhiteSmoke" BorderThickness="0,1,0,0" BorderBrush="Silver" Padding="2">
  8. <DockPanel>
  9. <ToggleSwitch Name="_hitRangeToggle" DockPanel.Dock="Right" OnContent="HitTestTextRange" OffContent="HitTestTextPosition" IsCheckedChanged="OnHitTestMethodChanged" />
  10. <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
  11. <TextBlock Text="HitTestPoint:" Margin="5,0" />
  12. <TextBlock Name="_coordinates" MinWidth="120" />
  13. <Border Width="5" BorderThickness="1,0,0,0" BorderBrush="Silver" UseLayoutRounding="True" Margin="5,0,0,0" />
  14. <TextBlock Text="TextPosition:" Margin="5,0" />
  15. <TextBlock Name="_hit" MinWidth="60" />
  16. <Border Width="5" BorderThickness="1,0,0,0" BorderBrush="Silver" UseLayoutRounding="True" Margin="5,0,0,0" />
  17. </StackPanel>
  18. </DockPanel>
  19. </Border>
  20. <DockPanel DockPanel.Dock="Top" Margin="5">
  21. <StackPanel Orientation="Horizontal" DockPanel.Dock="Right">
  22. <Label Content="_Font:" Target="{Binding ElementName=_font}" VerticalAlignment="Center" Margin="5,0,0,0" />
  23. <ComboBox Name="_font" ItemsSource="{Binding SystemFonts, Source={x:Static FontManager.Current}}" />
  24. <Label Content="_Size:" Target="{Binding ElementName=_size}" VerticalAlignment="Center" Margin="5,0,0,0" />
  25. <TextBox Name="_size" VerticalAlignment="Center" Text="64" />
  26. <Button VerticalAlignment="Center" Click="OnNewWindowClick" ToolTip.Tip="New window" Margin="5,0,0,0">+</Button>
  27. </StackPanel>
  28. <Label Content="_Text:" Target="{Binding ElementName=_text}" VerticalAlignment="Center"/>
  29. <TextBox Name="_text" Text="Hello!" VerticalAlignment="Center" />
  30. </DockPanel>
  31. <Grid RowDefinitions="*,5,*">
  32. <local:InteractiveLineControl Name="_rendering" DockPanel.Dock="Top" Margin="16" HorizontalAlignment="Center"
  33. Text="{Binding Text, ElementName=_text}"
  34. FontFamily="{Binding SelectedValue, ElementName=_font}"
  35. FontSize="{Binding Text, ElementName=_size}"
  36. Background="BlanchedAlmond"
  37. ExtentStroke="Black"
  38. BaselineStroke="Blue"
  39. TextBoundsStroke="Goldenrod"
  40. RunBoundsStroke="Gold"
  41. NextHitStroke="Green"
  42. PreviousHitStroke="Blue"
  43. BackspaceHitStroke="Red"
  44. DistanceStroke="Black"
  45. PointerMoved="OnPointerMoved"
  46. />
  47. <GridSplitter Grid.Row="1" />
  48. <TabControl Grid.Row="2" DockPanel.Dock="Bottom" Background="White" BorderBrush="Whitesmoke" BorderThickness="0,1,0,0">
  49. <TabItem Header="Shaped Buffer">
  50. <ListBox Name="_buffer" Grid.IsSharedSizeScope="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" SelectionMode="Multiple" SelectionChanged="OnBufferSelectionChanged" Background="Transparent">
  51. <ListBox.Styles>
  52. <Style Selector="ListBoxItem">
  53. <Setter Property="Padding" Value="0"/>
  54. <Setter Property="Background" Value="White" />
  55. </Style>
  56. </ListBox.Styles>
  57. <Border Background="WhiteSmoke" BorderBrush="Silver" BorderThickness="0,1">
  58. <local:GridRow ColumnSpacing="10">
  59. <TextBlock Text="" />
  60. <TextBlock Text="Index" />
  61. <TextBlock Text="Characters" />
  62. <TextBlock Text="Codepoints" />
  63. <TextBlock Text="Glyph" />
  64. <TextBlock Text="Glyph ID" />
  65. <TextBlock Text="Advance" />
  66. <TextBlock Text="Offset" />
  67. <TextBlock Text="Ink Bounds" />
  68. </local:GridRow>
  69. </Border>
  70. </ListBox>
  71. </TabItem>
  72. <TabItem Header="Character Hits">
  73. <ListBox Name="_hits" Grid.IsSharedSizeScope="True" ScrollViewer.HorizontalScrollBarVisibility="Auto" SelectionChanged="OnHitsSelectionChanged" Background="Transparent">
  74. <ListBox.Styles>
  75. <Style Selector="ListBoxItem">
  76. <Setter Property="Padding" Value="0"/>
  77. <Setter Property="Background" Value="White" />
  78. </Style>
  79. </ListBox.Styles>
  80. <Border Background="WhiteSmoke" BorderBrush="Silver" BorderThickness="0,1">
  81. <local:GridRow ColumnSpacing="10">
  82. <TextBlock Text="" />
  83. <TextBlock Text="Backspace Hit" />
  84. <TextBlock Text="Previous Hit" />
  85. <TextBlock Text="Index" />
  86. <TextBlock Text="Next Hit" />
  87. <TextBlock Text="Codepoint" />
  88. <TextBlock Text="Character" />
  89. <TextBlock Text="Distance" />
  90. </local:GridRow>
  91. </Border>
  92. </ListBox>
  93. </TabItem>
  94. </TabControl>
  95. </Grid>
  96. </DockPanel>
  97. </Window>