mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-23 18:06:34 +08:00
* feat: replace Watermark with PlaceholderText in AutoCompleteBox and related controls * fix: remove duplicate PlaceholderForeground setter.
235 lines
15 KiB
XML
235 lines
15 KiB
XML
<ResourceDictionary
|
|
xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:iri="https://irihi.tech/shared"
|
|
xmlns:dialogs="using:Avalonia.Dialogs"
|
|
xmlns:internal="using:Avalonia.Dialogs.Internal"
|
|
xmlns:cvt="using:Avalonia.Controls.Converters">
|
|
<Design.PreviewWith>
|
|
<Border
|
|
Width="800"
|
|
Height="500"
|
|
Padding="20">
|
|
<dialogs:ManagedFileChooser />
|
|
</Border>
|
|
</Design.PreviewWith>
|
|
|
|
<iri:ResourceConverter x:Key="Icons">
|
|
<StreamGeometry x:Key="Icon_Folder">M19,20H4C2.89,20 2,19.1 2,18V6C2,4.89 2.89,4 4,4H10L12,6H19A2,2 0 0,1 21,8H21L4,8V18L6.14,10H23.21L20.93,18.5C20.7,19.37 19.92,20 19,20Z</StreamGeometry>
|
|
<StreamGeometry x:Key="Icon_File">M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M15,18V16H6V18H15M18,14V12H6V14H18Z</StreamGeometry>
|
|
<StreamGeometry x:Key="Icon_Volume">M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M12,4A6,6 0 0,0 6,10C6,13.31 8.69,16 12.1,16L11.22,13.77C10.95,13.29 11.11,12.68 11.59,12.4L12.45,11.9C12.93,11.63 13.54,11.79 13.82,12.27L15.74,14.69C17.12,13.59 18,11.9 18,10A6,6 0 0,0 12,4M12,9A1,1 0 0,1 13,10A1,1 0 0,1 12,11A1,1 0 0,1 11,10A1,1 0 0,1 12,9M7,18A1,1 0 0,0 6,19A1,1 0 0,0 7,20A1,1 0 0,0 8,19A1,1 0 0,0 7,18M12.09,13.27L14.58,19.58L17.17,18.08L12.95,12.77L12.09,13.27Z</StreamGeometry>
|
|
</iri:ResourceConverter>
|
|
<ControlTheme x:Key="{x:Type dialogs:ManagedFileChooser}" TargetType="dialogs:ManagedFileChooser">
|
|
<Setter Property="Template">
|
|
<ControlTemplate x:DataType="internal:ManagedFileChooserViewModel" TargetType="dialogs:ManagedFileChooser">
|
|
<DockPanel>
|
|
<Border
|
|
Margin="8"
|
|
Padding="4"
|
|
DockPanel.Dock="Left"
|
|
Theme="{DynamicResource CardBorder}">
|
|
<ListBox
|
|
Name="PART_QuickLinks"
|
|
Focusable="False"
|
|
ItemsSource="{Binding QuickLinks}"
|
|
SelectedIndex="{Binding QuickLinksSelectedIndex}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<StackPanel Orientation="Horizontal" Spacing="4">
|
|
<PathIcon
|
|
Theme="{DynamicResource InnerPathIcon}"
|
|
Data="{Binding IconKey, Converter={StaticResource Icons}}"
|
|
Foreground="{DynamicResource ManagedFileChooserIconForeground}" />
|
|
<TextBlock Foreground="{DynamicResource ManagedFileChooserTextForeground}" Text="{Binding DisplayName}" />
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</Border>
|
|
<DockPanel
|
|
Name="NavBar"
|
|
Margin="8,8,8,0"
|
|
VerticalAlignment="Center"
|
|
DockPanel.Dock="Top">
|
|
<Button
|
|
Command="{Binding GoUp}"
|
|
DockPanel.Dock="Left"
|
|
Theme="{DynamicResource BorderlessButton}">
|
|
<PathIcon
|
|
Theme="{DynamicResource InnerPathIcon}"
|
|
Data="{DynamicResource ManagedFileChooserUpButtonGlyph}"
|
|
Foreground="{DynamicResource ManagedFileChooserIconForeground}" />
|
|
</Button>
|
|
<TextBox Name="Location" Text="{Binding Location}">
|
|
<TextBox.KeyBindings>
|
|
<KeyBinding Command="{Binding EnterPressed}" Gesture="Enter" />
|
|
</TextBox.KeyBindings>
|
|
</TextBox>
|
|
</DockPanel>
|
|
<DockPanel Margin="8,0,8,8" DockPanel.Dock="Bottom">
|
|
<DockPanel Margin="0,0,0,8" DockPanel.Dock="Top">
|
|
<ComboBox
|
|
Margin="8,0,0,0"
|
|
DockPanel.Dock="Right"
|
|
IsVisible="{Binding ShowFilters}"
|
|
ItemsSource="{Binding Filters}"
|
|
SelectedItem="{Binding SelectedFilter}" />
|
|
<TextBox
|
|
IsVisible="{Binding !SelectingFolder}"
|
|
Text="{Binding FileName}"
|
|
PlaceholderText="{DynamicResource STRING_CHOOSER_FILE_NAME}" />
|
|
</DockPanel>
|
|
<CheckBox
|
|
VerticalAlignment="Center"
|
|
Content="{DynamicResource STRING_CHOOSER_SHOW_HIDDEN_FILES}"
|
|
DockPanel.Dock="Left"
|
|
IsChecked="{Binding ShowHiddenFiles}" />
|
|
<UniformGrid
|
|
Name="Finalize"
|
|
HorizontalAlignment="Right"
|
|
Rows="1">
|
|
<Button
|
|
Margin="8,0,0,0"
|
|
Classes="Primary"
|
|
Command="{Binding Ok}"
|
|
Content="{DynamicResource STRING_CHOOSER_DIALOG_OK}" />
|
|
<Button
|
|
Margin="8,0,0,0"
|
|
Classes="Danger"
|
|
Command="{Binding Cancel}"
|
|
Content="{DynamicResource STRING_CHOOSER_DIALOG_CANCEL}" />
|
|
</UniformGrid>
|
|
</DockPanel>
|
|
<Border
|
|
Margin="8"
|
|
Padding="8"
|
|
Theme="{DynamicResource CardBorder}">
|
|
<DockPanel Grid.IsSharedSizeScope="True">
|
|
<Grid
|
|
HorizontalAlignment="Stretch"
|
|
ClipToBounds="True"
|
|
DockPanel.Dock="Top">
|
|
<Grid.Styles>
|
|
<Style Selector="TextBlock">
|
|
<Setter Property="Height" Value="24" />
|
|
<Setter Property="VerticalAlignment" Value="Center" />
|
|
<Setter Property="Margin" Value="8 0 0 0 " />
|
|
</Style>
|
|
</Grid.Styles>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="20" SharedSizeGroup="Icon" />
|
|
<ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
|
|
<ColumnDefinition Width="275" SharedSizeGroup="Name" />
|
|
<ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
|
|
<ColumnDefinition Width="200" SharedSizeGroup="Modified" />
|
|
<ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
|
|
<ColumnDefinition Width="150" SharedSizeGroup="Type" />
|
|
<ColumnDefinition Width="16" SharedSizeGroup="Splitter" />
|
|
<ColumnDefinition Width="200" SharedSizeGroup="Size" />
|
|
</Grid.ColumnDefinitions>
|
|
<GridSplitter Grid.Column="1" Width="1" />
|
|
<TextBlock Grid.Column="2" Text="{DynamicResource STRING_CHOOSER_NAME_COLUMN}" />
|
|
<GridSplitter Grid.Column="3" Width="1" />
|
|
<TextBlock Grid.Column="4" Text="{DynamicResource STRING_CHOOSER_DATEMODIFIED_COLUMN}" />
|
|
<GridSplitter Grid.Column="5" Width="1" />
|
|
<TextBlock Grid.Column="6" Text="{DynamicResource STRING_CHOOSER_TYPE_COLUMN}" />
|
|
<GridSplitter Grid.Column="7" Width="1" />
|
|
<TextBlock Grid.Column="8" Text="{DynamicResource STRING_CHOOSER_SIZE_COLUMN}" />
|
|
</Grid>
|
|
<ListBox
|
|
Name="PART_Files"
|
|
ItemsSource="{Binding Items}"
|
|
SelectedItems="{Binding SelectedItems}"
|
|
SelectionMode="{Binding SelectionMode}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<Grid Background="Transparent">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition SharedSizeGroup="Icon" />
|
|
<ColumnDefinition SharedSizeGroup="Splitter" />
|
|
<ColumnDefinition SharedSizeGroup="Name" />
|
|
<ColumnDefinition SharedSizeGroup="Splitter" />
|
|
<ColumnDefinition SharedSizeGroup="Modified" />
|
|
<ColumnDefinition SharedSizeGroup="Splitter" />
|
|
<ColumnDefinition SharedSizeGroup="Type" />
|
|
<ColumnDefinition SharedSizeGroup="Splitter" />
|
|
<ColumnDefinition SharedSizeGroup="Size" />
|
|
</Grid.ColumnDefinitions>
|
|
<PathIcon
|
|
Theme="{DynamicResource InnerPathIcon}"
|
|
Data="{Binding IconKey, Converter={StaticResource Icons}}"
|
|
Foreground="{DynamicResource ManagedFileChooserIconForeground}" />
|
|
<TextBlock
|
|
Grid.Column="2"
|
|
Foreground="{DynamicResource ManagedFileChooserTextForeground}"
|
|
Text="{Binding DisplayName}" />
|
|
<TextBlock
|
|
Grid.Column="4"
|
|
Foreground="{DynamicResource ManagedFileChooserTextForeground}"
|
|
Text="{Binding Modified}" />
|
|
<TextBlock
|
|
Grid.Column="6"
|
|
Foreground="{DynamicResource ManagedFileChooserTextForeground}"
|
|
Text="{Binding Type}" />
|
|
<TextBlock Grid.Column="8" Foreground="{DynamicResource ManagedFileChooserTextForeground}">
|
|
<TextBlock.Text>
|
|
<Binding Path="Size">
|
|
<Binding.Converter>
|
|
<internal:FileSizeStringConverter />
|
|
</Binding.Converter>
|
|
</Binding>
|
|
</TextBlock.Text>
|
|
</TextBlock>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
</DockPanel>
|
|
</Border>
|
|
</DockPanel>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</ControlTheme>
|
|
|
|
<ControlTheme x:Key="{x:Type dialogs:ManagedFileChooserOverwritePrompt}"
|
|
TargetType="dialogs:ManagedFileChooserOverwritePrompt">
|
|
<Setter Property="MaxWidth" Value="400" />
|
|
<Setter Property="Padding" Value="10" />
|
|
<Setter Property="Template">
|
|
<ControlTemplate>
|
|
<Border Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{TemplateBinding CornerRadius}"
|
|
Padding="{TemplateBinding Padding}">
|
|
<StackPanel Spacing="10">
|
|
<TextBlock TextWrapping="Wrap">
|
|
<TextBlock.Text>
|
|
<MultiBinding>
|
|
<MultiBinding.Converter>
|
|
<cvt:StringFormatConverter />
|
|
</MultiBinding.Converter>
|
|
<DynamicResource ResourceKey="STRING_CHOOSER_PROMPT_FILE_ALREADY_EXISTS" />
|
|
<TemplateBinding Property="FileName" />
|
|
</MultiBinding>
|
|
</TextBlock.Text>
|
|
</TextBlock>
|
|
<StackPanel HorizontalAlignment="Right"
|
|
Spacing="10"
|
|
Orientation="Horizontal">
|
|
<Button Theme="{StaticResource SolidButton}"
|
|
Content="{DynamicResource STRING_CHOOSER_DIALOG_OK}"
|
|
HorizontalContentAlignment="Center"
|
|
IsDefault="True"
|
|
Command="{Binding Confirm, RelativeSource={RelativeSource TemplatedParent}}" />
|
|
<Button Content="{DynamicResource STRING_CHOOSER_DIALOG_CANCEL}"
|
|
IsCancel="True"
|
|
HorizontalContentAlignment="Center"
|
|
Command="{Binding Cancel, RelativeSource={RelativeSource TemplatedParent}}" />
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</Setter>
|
|
</ControlTheme>
|
|
</ResourceDictionary> |