DirectorySelector.xaml 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <UserControl x:Class="HistoryView.Controls.FileSelector.DirectorySelector"
  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:HistoryView.Controls.FileSelector"
  7. xmlns:resource="clr-namespace:HistoryView.Resources"
  8. mc:Ignorable="d"
  9. x:Name="This"
  10. d:DesignHeight="450" d:DesignWidth="800">
  11. <UserControl.Resources>
  12. <Style TargetType="Button">
  13. <Setter Property="BorderThickness" Value="0"/>
  14. <Setter Property="Template">
  15. <Setter.Value>
  16. <ControlTemplate TargetType="Button">
  17. <Border x:Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="0">
  18. <ContentPresenter Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4"/>
  19. </Border>
  20. <ControlTemplate.Triggers>
  21. <Trigger Property="IsPressed" Value="True">
  22. <Setter TargetName="border" Property="Background" Value="{StaticResource SubThemeColor}"/>
  23. </Trigger>
  24. </ControlTemplate.Triggers>
  25. </ControlTemplate>
  26. </Setter.Value>
  27. </Setter>
  28. </Style>
  29. </UserControl.Resources>
  30. <Border BorderThickness="0" BorderBrush="Black">
  31. <Grid>
  32. <Grid.ColumnDefinitions>
  33. <ColumnDefinition Width="160" />
  34. <ColumnDefinition Width="0"/>
  35. <ColumnDefinition Width="*"/>
  36. </Grid.ColumnDefinitions>
  37. <Border Background="{StaticResource LightThemeColor}" BorderBrush="{StaticResource ThemeColor}" BorderThickness="0" CornerRadius="0,0,0,8">
  38. <StackPanel>
  39. <!--<Expander Background="Transparent" VerticalAlignment="Top" Margin="4" IsExpanded="True">-->
  40. <!--<Expander.Header>
  41. <Border CornerRadius="4">
  42. <TextBlock FontWeight="Bold" Margin="4" Foreground="{StaticResource ThemeColor}" VerticalAlignment="Center">磁盘空间</TextBlock>
  43. </Border>
  44. </Expander.Header>-->
  45. <Border Background="{StaticResource LightThemeColor}" Margin="0">
  46. <ItemsControl ItemsSource="{Binding ElementName=This, Path=BaseFolder}">
  47. <ItemsControl.ItemTemplate>
  48. <DataTemplate>
  49. <Button Background="Transparent" Foreground="Transparent" Click="Button_Click" CommandParameter="{Binding}">
  50. <local:FileHorizontal ImageSource="{Binding ImageSource}" FileName="{Binding Name}" Background="Transparent" TextElement.Foreground="{StaticResource ThemeColor}" Height="48"/>
  51. </Button>
  52. </DataTemplate>
  53. </ItemsControl.ItemTemplate>
  54. </ItemsControl>
  55. </Border>
  56. <!--</Expander>-->
  57. </StackPanel>
  58. </Border>
  59. <Grid Grid.Column="2">
  60. <Grid.RowDefinitions>
  61. <RowDefinition Height="auto"/>
  62. <RowDefinition Height="0"/>
  63. <RowDefinition/>
  64. <RowDefinition Height="0"/>
  65. <RowDefinition Height="auto"/>
  66. </Grid.RowDefinitions>
  67. <Border BorderBrush="{StaticResource ThemeColor}" Background="{StaticResource LightThemeColor}" >
  68. <Grid Margin="0,4">
  69. <Grid.RowDefinitions>
  70. <RowDefinition Height="auto"/>
  71. <RowDefinition Height="0"/>
  72. <RowDefinition Height="auto"/>
  73. </Grid.RowDefinitions>
  74. <!--<TextBlock FontWeight="Bold" Margin="4" Foreground="{StaticResource ThemeColor}">快速导航栏</TextBlock>-->
  75. <Grid Grid.Row="2">
  76. <Grid.ColumnDefinitions>
  77. <ColumnDefinition Width="auto"/>
  78. <ColumnDefinition Width="12"/>
  79. <ColumnDefinition/>
  80. </Grid.ColumnDefinitions>
  81. <Button Style="{StaticResource FunctionButton}" Click="Button_Click_1" VerticalAlignment="Center" Height="28">
  82. <TextBlock Text="&lt;" FontSize="14" FontWeight="Bold"/>
  83. </Button>
  84. <ItemsControl Grid.Column="2" ItemsSource="{Binding ElementName=This, Path=Parents}">
  85. <ItemsControl.ItemTemplate>
  86. <DataTemplate>
  87. <StackPanel Orientation="Horizontal">
  88. <Button Style="{StaticResource FunctionButton}" Background="{StaticResource DarkBorderColor}" Click="Button_Click" CommandParameter="{Binding Value}" VerticalAlignment="Center" Margin="4,2">
  89. <TextBlock VerticalAlignment="Center" Text="{Binding Value.Name}"/>
  90. </Button>
  91. <TextBlock VerticalAlignment="Center" FontSize="14" FontWeight="Bold" Foreground="{StaticResource TextColor}" Margin="4,2">></TextBlock>
  92. </StackPanel>
  93. </DataTemplate>
  94. </ItemsControl.ItemTemplate>
  95. <ItemsControl.ItemsPanel>
  96. <ItemsPanelTemplate>
  97. <WrapPanel Orientation="Horizontal"/>
  98. </ItemsPanelTemplate>
  99. </ItemsControl.ItemsPanel>
  100. </ItemsControl>
  101. </Grid>
  102. </Grid>
  103. </Border>
  104. <Border Grid.Row="2" BorderBrush="{StaticResource ThemeColor}" Background="{StaticResource BackgroundColor}" CornerRadius="0,0,8,0">
  105. <resource:TouchableScrollViewer VerticalScrollBarVisibility="Hidden">
  106. <ItemsControl ItemsSource="{Binding ElementName=This, Path=Displays}">
  107. <ItemsControl.ItemTemplate>
  108. <DataTemplate>
  109. <Button Background="Transparent" Click="Button_Click" CommandParameter="{Binding}" VerticalAlignment="Top">
  110. <local:FileVertical ImageSource="{Binding ImageSource}" FileName="{Binding Name}" FileType="{Binding FileType}" Background="Transparent" TextElement.Foreground="{StaticResource ThemeColor}" Width="96"/>
  111. </Button>
  112. </DataTemplate>
  113. </ItemsControl.ItemTemplate>
  114. <ItemsControl.ItemsPanel>
  115. <ItemsPanelTemplate>
  116. <WrapPanel Margin="8" VerticalAlignment="Top" HorizontalAlignment="Left"/>
  117. </ItemsPanelTemplate>
  118. </ItemsControl.ItemsPanel>
  119. </ItemsControl>
  120. </resource:TouchableScrollViewer>
  121. </Border>
  122. <Border Grid.Row="4" Background="Transparent" BorderBrush="{StaticResource DarkBorderColor}" BorderThickness="0,1,0,0">
  123. <Grid Margin="8">
  124. <Grid.ColumnDefinitions>
  125. <ColumnDefinition Width="auto"/>
  126. <ColumnDefinition Width="8"/>
  127. <ColumnDefinition/>
  128. <ColumnDefinition Width="8"/>
  129. <ColumnDefinition Width="auto"/>
  130. <ColumnDefinition Width="8"/>
  131. <ColumnDefinition Width="auto"/>
  132. </Grid.ColumnDefinitions>
  133. <TextBlock Margin="4" VerticalAlignment="Center" Text="文件选择:"/>
  134. <Border Grid.Column="2" Background="#cadce9" CornerRadius="4">
  135. <TextBlock Margin="8,4" VerticalAlignment="Center" Text="{Binding ElementName=This, Path=SelectedFile.Name}"/>
  136. </Border>
  137. <Button Style="{StaticResource FunctionButton}" Grid.Column="4" Width="80" Height="28" Command="{Binding ElementName=This, Path=Confirm}">选择</Button>
  138. <Button Style="{StaticResource FunctionButton}" Grid.Column="6" Width="80" Height="28" Command="{Binding ElementName=This,Path=Cancel}" Background="{StaticResource BackgroundDarkColor}">取消</Button>
  139. </Grid>
  140. </Border>
  141. </Grid>
  142. </Grid>
  143. </Border>
  144. </UserControl>