RulesPage.xaml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <Page x:Class="ClashDotNetFramework.Pages.RulesPage"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:ClashDotNetFramework.Pages"
  7. xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
  8. xmlns:share="clr-namespace:Clash.SDK.Models.Share;assembly=Clash-SDK"
  9. mc:Ignorable="d" FontSize="14" Loaded="Page_Loaded"
  10. d:DesignHeight="450" d:DesignWidth="800"
  11. Title="RulesPage">
  12. <Page.Resources>
  13. <Style x:Key="BorderStyle" TargetType="Border">
  14. <Setter Property="CornerRadius" Value="2"/>
  15. <Setter Property="Background" Value="{DynamicResource BorderBackground}"/>
  16. <Setter Property="Margin" Value="0,5,0,0"/>
  17. <Setter Property="Padding" Value="4,4"/>
  18. <Setter Property="HorizontalAlignment" Value="Left"/>
  19. </Style>
  20. <DataTemplate x:Key="RuleItemTemplate" DataType="share:ClashRuleData">
  21. <Grid Margin="0,0,0,5">
  22. <Grid.ColumnDefinitions>
  23. <!-- Rule PayLoad & Type -->
  24. <ColumnDefinition Width="*"/>
  25. <!-- Rule Type -->
  26. <ColumnDefinition Width="Auto"/>
  27. </Grid.ColumnDefinitions>
  28. <!-- Rule PayLoad & Type -->
  29. <Grid>
  30. <Grid.RowDefinitions>
  31. <!-- Rule PayLoad -->
  32. <RowDefinition/>
  33. <!-- Rule Type -->
  34. <RowDefinition/>
  35. </Grid.RowDefinitions>
  36. <!-- Rule PayLoad -->
  37. <TextBlock
  38. Foreground="{DynamicResource NormalTextForeground}"
  39. Text="{Binding PayLoad}"/>
  40. <!-- Rule Type -->
  41. <Border
  42. Grid.Row="1"
  43. Style="{StaticResource BorderStyle}">
  44. <TextBlock
  45. Foreground="White"
  46. Text="{Binding Type}"/>
  47. </Border>
  48. </Grid>
  49. <!-- Rule Proxy -->
  50. <emoji:TextBlock
  51. Grid.Column="1"
  52. Foreground="{DynamicResource NormalTextForeground}"
  53. Text="{Binding Proxy}"
  54. HorizontalAlignment="Right"
  55. VerticalAlignment="Center"/>
  56. </Grid>
  57. </DataTemplate>
  58. </Page.Resources>
  59. <Grid>
  60. <Grid.RowDefinitions>
  61. <!-- Page Title -->
  62. <RowDefinition Height="100"/>
  63. <!-- Rule ListView -->
  64. <RowDefinition/>
  65. </Grid.RowDefinitions>
  66. <!-- Page Title -->
  67. <TextBlock
  68. Text="{DynamicResource Rules}"
  69. FontSize="24"
  70. Foreground="{DynamicResource NormalTextForeground}"
  71. VerticalAlignment="Center"
  72. Margin="20,0,0,0"/>
  73. <Separator
  74. VerticalAlignment="Bottom"
  75. Background="{DynamicResource SeparatorBackground}"/>
  76. <!-- Rule ListView -->
  77. <Grid
  78. Grid.Row="1"
  79. Margin="14,5,20,20">
  80. <ListView
  81. Background="Transparent"
  82. BorderBrush="Transparent"
  83. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  84. ItemTemplate="{StaticResource RuleItemTemplate}"
  85. SelectionMode="Single"
  86. HorizontalContentAlignment="Stretch"
  87. x:Name="RuleItemListView"/>
  88. </Grid>
  89. </Grid>
  90. </Page>