22 changed files with 731 additions and 261 deletions
@ -0,0 +1,44 @@ |
|||||
|
#nullable enable |
||||
|
using System; |
||||
|
using System.Globalization; |
||||
|
|
||||
|
using Avalonia.Data.Converters; |
||||
|
|
||||
|
namespace Avalonia.Controls.Converters |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Converts an existing CornerRadius struct to a new CornerRadius struct,
|
||||
|
/// with filters applied to extract only the specified fields, leaving the others set to 0.
|
||||
|
/// </summary>
|
||||
|
public class CornerRadiusFilterConverter : IValueConverter |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Gets or sets the type of the filter applied to the <see cref="CornerRadiusFilterConverter"/>.
|
||||
|
/// </summary>
|
||||
|
public CornerRadiusFilterKinds Filter { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// Gets or sets the scale multiplier applied to the <see cref="CornerRadiusFilterConverter"/>.
|
||||
|
/// </summary>
|
||||
|
public double Scale { get; set; } = 1; |
||||
|
|
||||
|
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture) |
||||
|
{ |
||||
|
if (!(value is CornerRadius radius)) |
||||
|
{ |
||||
|
return value; |
||||
|
} |
||||
|
|
||||
|
return new CornerRadius( |
||||
|
Filter.HasAllFlags(CornerRadiusFilterKinds.TopLeft) ? radius.TopLeft * Scale : 0, |
||||
|
Filter.HasAllFlags(CornerRadiusFilterKinds.TopRight) ? radius.TopRight * Scale : 0, |
||||
|
Filter.HasAllFlags(CornerRadiusFilterKinds.BottomRight) ? radius.BottomRight * Scale : 0, |
||||
|
Filter.HasAllFlags(CornerRadiusFilterKinds.BottomLeft) ? radius.BottomLeft * Scale : 0); |
||||
|
} |
||||
|
|
||||
|
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) |
||||
|
{ |
||||
|
throw new NotImplementedException(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace Avalonia.Controls.Converters |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// Defines constants that specify the filter type for a <see cref="CornerRadiusFilterConverter"/> instance.
|
||||
|
/// </summary>
|
||||
|
[Flags] |
||||
|
public enum CornerRadiusFilterKinds |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// No filter applied.
|
||||
|
/// </summary>
|
||||
|
None, |
||||
|
/// <summary>
|
||||
|
/// Filters TopLeft value.
|
||||
|
/// </summary>
|
||||
|
TopLeft = 1, |
||||
|
/// <summary>
|
||||
|
/// Filters TopRight value.
|
||||
|
/// </summary>
|
||||
|
TopRight = 2, |
||||
|
/// <summary>
|
||||
|
/// Filters BottomLeft value.
|
||||
|
/// </summary>
|
||||
|
BottomLeft = 4, |
||||
|
/// <summary>
|
||||
|
/// Filters BottomRight value.
|
||||
|
/// </summary>
|
||||
|
BottomRight = 8 |
||||
|
} |
||||
|
} |
||||
@ -1,144 +0,0 @@ |
|||||
<UserControl xmlns="https://github.com/avaloniaui" |
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|
||||
xmlns:dialogs="clr-namespace:Avalonia.Dialogs" |
|
||||
xmlns:internal="clr-namespace:Avalonia.Dialogs" |
|
||||
x:Class="Avalonia.Dialogs.ManagedFileChooser" Margin="10"> |
|
||||
<UserControl.Resources> |
|
||||
<internal:FileSizeStringConverter x:Key="FileSizeConverter" /> |
|
||||
<DrawingGroup x:Key="LevelUp"> |
|
||||
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> |
|
||||
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M14.5,0L6.39,0 5.39,2 2.504,2C1.677,2,1,2.673,1,3.5L1,10.582 1,10.586 1,15.414 3,13.414 3,16 7,16 7,13.414 9,15.414 9,13 14.5,13C15.327,13,16,12.327,16,11.5L16,1.5C16,0.673,15.327,0,14.5,0" /> |
|
||||
<GeometryDrawing Brush="#FFDCB679" Geometry="F1M14,3L7.508,3 8.008,2 8.012,2 14,2z M14.5,1L7.008,1 6.008,3 2.504,3C2.227,3,2,3.224,2,3.5L2,9.582 4.998,6.586 9,10.586 9,12 14.5,12C14.775,12,15,11.776,15,11.5L15,1.5C15,1.224,14.775,1,14.5,1" /> |
|
||||
<GeometryDrawing Brush="#FF00529C" Geometry="F1M8,11L5,8 2,11 2,13 4,11 4,15 6,15 6,11 8,13z" /> |
|
||||
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M8.0001,1.9996L7.5001,3.0006 14.0001,3.0006 14.0001,1.9996z" /> |
|
||||
</DrawingGroup> |
|
||||
<dialogs:ResourceSelectorConverter x:Key="Icons"> |
|
||||
<DrawingGroup x:Key="Icon_Folder"> |
|
||||
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M0,0L16,0 16,16 0,16z" /> |
|
||||
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M1.5,1L9.61,1 10.61,3 13.496,3C14.323,3,14.996,3.673,14.996,4.5L14.996,12.5C14.996,13.327,14.323,14,13.496,14L1.5,14C0.673,14,0,13.327,0,12.5L0,2.5C0,1.673,0.673,1,1.5,1" /> |
|
||||
<GeometryDrawing Brush="#FFDCB67A" Geometry="F1M2,3L8.374,3 8.874,4 2,4z M13.496,4L10,4 9.992,4 8.992,2 1.5,2C1.225,2,1,2.224,1,2.5L1,12.5C1,12.776,1.225,13,1.5,13L13.496,13C13.773,13,13.996,12.776,13.996,12.5L13.996,4.5C13.996,4.224,13.773,4,13.496,4" /> |
|
||||
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M2,3L8.374,3 8.874,4 2,4z" /> |
|
||||
</DrawingGroup> |
|
||||
<DrawingGroup x:Key="Icon_File"> |
|
||||
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> |
|
||||
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M4,15C3.03,15,2,14.299,2,13L2,3C2,1.701,3.03,1,4,1L10.061,1 14,4.556 14,13C14,13.97,13.299,15,12,15z" /> |
|
||||
<GeometryDrawing Brush="#FF9B4E96" Geometry="F1M12,13L4,13 4,3 9,3 9,6 12,6z M9.641,2L3.964,2C3.964,2,3,2,3,3L3,13C3,14,3.964,14,3.964,14L11.965,14C12.965,14,13,13,13,13L13,5z" /> |
|
||||
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M4,3L9,3 9,6 12,6 12,13 4,13z" /> |
|
||||
</DrawingGroup> |
|
||||
<DrawingGroup x:Key="Icon_Volume"> |
|
||||
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> |
|
||||
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M0,12L0,6.5C0,5.122,1.122,4,2.5,4L13.5,4C14.879,4,16,5.122,16,6.5L16,12z" /> |
|
||||
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M13,8L12,8 12,7 13,7z M11,8L10,8 10,7 11,7z M13.5,6L2.5,6C2.224,6,2,6.224,2,6.5L2,10 14,10 14,6.5C14,6.224,13.775,6,13.5,6" /> |
|
||||
<GeometryDrawing Brush="#FF424242" Geometry="F1M13,7L12,7 12,8 13,8z M11,7L10,7 10,8 11,8z M2,10L14,10 14,6.5C14,6.224,13.775,6,13.5,6L2.5,6C2.224,6,2,6.224,2,6.5z M15,11L1,11 1,6.5C1,5.673,1.673,5,2.5,5L13.5,5C14.327,5,15,5.673,15,6.5z" /> |
|
||||
</DrawingGroup> |
|
||||
</dialogs:ResourceSelectorConverter> |
|
||||
</UserControl.Resources> |
|
||||
<DockPanel> |
|
||||
<DockPanel DockPanel.Dock="Top" Margin="0 0 0 5"> |
|
||||
<dialogs:ChildFitter DockPanel.Dock="Right" Width="{Binding ElementName=Location, Path=Bounds.Height}"> |
|
||||
<Button Command="{Binding GoUp}" > |
|
||||
|
|
||||
<DrawingPresenter Drawing="{StaticResource LevelUp}" Stretch="Fill"/> |
|
||||
</Button> |
|
||||
</dialogs:ChildFitter> |
|
||||
<TextBox x:Name="Location" Text="{Binding Location}" Margin="0 0 5 0"> |
|
||||
<TextBox.KeyBindings> |
|
||||
<KeyBinding Command="{Binding EnterPressed}" Gesture="Enter"/> |
|
||||
</TextBox.KeyBindings> |
|
||||
</TextBox> |
|
||||
</DockPanel> |
|
||||
<DockPanel Margin="0 5 0 0" DockPanel.Dock="Bottom"> |
|
||||
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> |
|
||||
<CheckBox IsChecked="{Binding ShowHiddenFiles}"> |
|
||||
<TextBlock>Show hidden files</TextBlock> |
|
||||
</CheckBox> |
|
||||
</StackPanel> |
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10"> |
|
||||
<StackPanel.Styles> |
|
||||
<Style Selector="Button"> |
|
||||
<Setter Property="Margin" Value="4"/> |
|
||||
</Style> |
|
||||
</StackPanel.Styles> |
|
||||
<Button Command="{Binding Ok}">OK</Button> |
|
||||
<Button Command="{Binding Cancel}">Cancel</Button> |
|
||||
</StackPanel> |
|
||||
</DockPanel> |
|
||||
|
|
||||
<ComboBox DockPanel.Dock="Bottom" |
|
||||
IsVisible="{Binding ShowFilters}" |
|
||||
Items="{Binding Filters}" |
|
||||
SelectedItem="{Binding SelectedFilter}" |
|
||||
Margin="0 5 0 0" /> |
|
||||
|
|
||||
<TextBox Text="{Binding FileName}" Watermark="File name" DockPanel.Dock="Bottom" IsVisible="{Binding !SelectingFolder}" /> |
|
||||
|
|
||||
<ListBox Margin="0 0 5 5" BorderBrush="Transparent" x:Name="QuickLinks" Items="{Binding QuickLinks}" |
|
||||
SelectedIndex="{Binding QuickLinksSelectedIndex}" |
|
||||
DockPanel.Dock="Left" Focusable="False"> |
|
||||
<ListBox.ItemTemplate> |
|
||||
<DataTemplate> |
|
||||
<StackPanel Spacing="4" Orientation="Horizontal" Background="Transparent"> |
|
||||
<DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/> |
|
||||
<TextBlock Text="{Binding DisplayName}"/> |
|
||||
</StackPanel> |
|
||||
</DataTemplate> |
|
||||
</ListBox.ItemTemplate> |
|
||||
</ListBox> |
|
||||
<DockPanel Grid.IsSharedSizeScope="True"> |
|
||||
<Grid DockPanel.Dock="Top" Margin="15 5 0 0" HorizontalAlignment="Stretch"> |
|
||||
<Grid.ColumnDefinitions> |
|
||||
<ColumnDefinition Width="20" SharedSizeGroup="Icon" /> |
|
||||
<ColumnDefinition Width="16" SharedSizeGroup="Splitter" /> |
|
||||
<ColumnDefinition Width="400" 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" /> |
|
||||
<TextBlock Grid.Column="2" Text="Name" /> |
|
||||
<GridSplitter Grid.Column="3" /> |
|
||||
<TextBlock Grid.Column="4" Text="Date Modified" /> |
|
||||
<GridSplitter Grid.Column="5" /> |
|
||||
<TextBlock Grid.Column="6" Text="Type" /> |
|
||||
<GridSplitter Grid.Column="7" /> |
|
||||
<TextBlock Grid.Column="8" Text="Size" /> |
|
||||
</Grid> |
|
||||
<ListBox x:Name="Files" |
|
||||
VirtualizationMode="Simple" |
|
||||
Items="{Binding Items}" |
|
||||
Margin="0 5" |
|
||||
SelectionMode="{Binding SelectionMode}" |
|
||||
SelectedItems="{Binding SelectedItems}" |
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> |
|
||||
<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> |
|
||||
<DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/> |
|
||||
<TextBlock Grid.Column="2" Text="{Binding DisplayName}"/> |
|
||||
<TextBlock Grid.Column="4" Text="{Binding Modified}" /> |
|
||||
<TextBlock Grid.Column="6" Text="{Binding Type}" /> |
|
||||
<TextBlock Grid.Column="8" Text="{Binding Size, Converter={StaticResource FileSizeConverter}}" /> |
|
||||
</Grid> |
|
||||
</DataTemplate> |
|
||||
</ListBox.ItemTemplate> |
|
||||
</ListBox> |
|
||||
</DockPanel> |
|
||||
</DockPanel> |
|
||||
|
|
||||
</UserControl> |
|
||||
@ -1,13 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<PackageId>Avalonia.ReactiveUI.Events</PackageId> |
|
||||
<SignAssembly>false</SignAssembly> |
|
||||
</PropertyGroup> |
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\..\packages\Avalonia\Avalonia.csproj" /> |
|
||||
</ItemGroup> |
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Pharmacist.Common" Version="1.8.1" /> |
|
||||
</ItemGroup> |
|
||||
</Project> |
|
||||
@ -0,0 +1,153 @@ |
|||||
|
<Styles xmlns="https://github.com/avaloniaui" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs"> |
||||
|
<Style Selector="dialogs|ManagedFileChooser"> |
||||
|
<Style.Resources> |
||||
|
<ResourceDictionary> |
||||
|
<DrawingGroup x:Key="LevelUp"> |
||||
|
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> |
||||
|
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M14.5,0L6.39,0 5.39,2 2.504,2C1.677,2,1,2.673,1,3.5L1,10.582 1,10.586 1,15.414 3,13.414 3,16 7,16 7,13.414 9,15.414 9,13 14.5,13C15.327,13,16,12.327,16,11.5L16,1.5C16,0.673,15.327,0,14.5,0" /> |
||||
|
<GeometryDrawing Brush="#FFDCB679" Geometry="F1M14,3L7.508,3 8.008,2 8.012,2 14,2z M14.5,1L7.008,1 6.008,3 2.504,3C2.227,3,2,3.224,2,3.5L2,9.582 4.998,6.586 9,10.586 9,12 14.5,12C14.775,12,15,11.776,15,11.5L15,1.5C15,1.224,14.775,1,14.5,1" /> |
||||
|
<GeometryDrawing Brush="#FF00529C" Geometry="F1M8,11L5,8 2,11 2,13 4,11 4,15 6,15 6,11 8,13z" /> |
||||
|
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M8.0001,1.9996L7.5001,3.0006 14.0001,3.0006 14.0001,1.9996z" /> |
||||
|
</DrawingGroup> |
||||
|
<dialogs:ResourceSelectorConverter x:Key="Icons"> |
||||
|
<DrawingGroup x:Key="Icon_Folder"> |
||||
|
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M0,0L16,0 16,16 0,16z" /> |
||||
|
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M1.5,1L9.61,1 10.61,3 13.496,3C14.323,3,14.996,3.673,14.996,4.5L14.996,12.5C14.996,13.327,14.323,14,13.496,14L1.5,14C0.673,14,0,13.327,0,12.5L0,2.5C0,1.673,0.673,1,1.5,1" /> |
||||
|
<GeometryDrawing Brush="#FFDCB67A" Geometry="F1M2,3L8.374,3 8.874,4 2,4z M13.496,4L10,4 9.992,4 8.992,2 1.5,2C1.225,2,1,2.224,1,2.5L1,12.5C1,12.776,1.225,13,1.5,13L13.496,13C13.773,13,13.996,12.776,13.996,12.5L13.996,4.5C13.996,4.224,13.773,4,13.496,4" /> |
||||
|
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M2,3L8.374,3 8.874,4 2,4z" /> |
||||
|
</DrawingGroup> |
||||
|
<DrawingGroup x:Key="Icon_File"> |
||||
|
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> |
||||
|
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M4,15C3.03,15,2,14.299,2,13L2,3C2,1.701,3.03,1,4,1L10.061,1 14,4.556 14,13C14,13.97,13.299,15,12,15z" /> |
||||
|
<GeometryDrawing Brush="#FF9B4E96" Geometry="F1M12,13L4,13 4,3 9,3 9,6 12,6z M9.641,2L3.964,2C3.964,2,3,2,3,3L3,13C3,14,3.964,14,3.964,14L11.965,14C12.965,14,13,13,13,13L13,5z" /> |
||||
|
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M4,3L9,3 9,6 12,6 12,13 4,13z" /> |
||||
|
</DrawingGroup> |
||||
|
<DrawingGroup x:Key="Icon_Volume"> |
||||
|
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> |
||||
|
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M0,12L0,6.5C0,5.122,1.122,4,2.5,4L13.5,4C14.879,4,16,5.122,16,6.5L16,12z" /> |
||||
|
<GeometryDrawing Brush="#FFEFEFF0" Geometry="F1M13,8L12,8 12,7 13,7z M11,8L10,8 10,7 11,7z M13.5,6L2.5,6C2.224,6,2,6.224,2,6.5L2,10 14,10 14,6.5C14,6.224,13.775,6,13.5,6" /> |
||||
|
<GeometryDrawing Brush="#FF424242" Geometry="F1M13,7L12,7 12,8 13,8z M11,7L10,7 10,8 11,8z M2,10L14,10 14,6.5C14,6.224,13.775,6,13.5,6L2.5,6C2.224,6,2,6.224,2,6.5z M15,11L1,11 1,6.5C1,5.673,1.673,5,2.5,5L13.5,5C14.327,5,15,5.673,15,6.5z" /> |
||||
|
</DrawingGroup> |
||||
|
</dialogs:ResourceSelectorConverter> |
||||
|
</ResourceDictionary> |
||||
|
</Style.Resources> |
||||
|
<Setter Property="Template"> |
||||
|
<ControlTemplate> |
||||
|
<DockPanel> |
||||
|
<DockPanel DockPanel.Dock="Top" Margin="0 0 0 5"> |
||||
|
<dialogs:ChildFitter DockPanel.Dock="Right" Width="{Binding ElementName=Location, Path=Bounds.Height}"> |
||||
|
<Button Command="{Binding GoUp}"> |
||||
|
<DrawingPresenter Drawing="{StaticResource LevelUp}" Stretch="Fill"/> |
||||
|
</Button> |
||||
|
</dialogs:ChildFitter> |
||||
|
<TextBox x:Name="Location" Text="{Binding Location}" Margin="0 0 5 0"> |
||||
|
<TextBox.KeyBindings> |
||||
|
<KeyBinding Command="{Binding EnterPressed}" Gesture="Enter"/> |
||||
|
</TextBox.KeyBindings> |
||||
|
</TextBox> |
||||
|
</DockPanel> |
||||
|
<DockPanel Margin="0 5 0 0" DockPanel.Dock="Bottom"> |
||||
|
<StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> |
||||
|
<CheckBox IsChecked="{Binding ShowHiddenFiles}"> |
||||
|
<TextBlock>Show hidden files</TextBlock> |
||||
|
</CheckBox> |
||||
|
</StackPanel> |
||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10"> |
||||
|
<StackPanel.Styles> |
||||
|
<Style Selector="Button"> |
||||
|
<Setter Property="Margin" Value="4"/> |
||||
|
</Style> |
||||
|
</StackPanel.Styles> |
||||
|
<Button Command="{Binding Ok}">OK</Button> |
||||
|
<Button Command="{Binding Cancel}">Cancel</Button> |
||||
|
</StackPanel> |
||||
|
</DockPanel> |
||||
|
|
||||
|
<ComboBox DockPanel.Dock="Bottom" |
||||
|
IsVisible="{Binding ShowFilters}" |
||||
|
Items="{Binding Filters}" |
||||
|
SelectedItem="{Binding SelectedFilter}" |
||||
|
Margin="0 5 0 0" /> |
||||
|
|
||||
|
<TextBox Text="{Binding FileName}" Watermark="File name" DockPanel.Dock="Bottom" IsVisible="{Binding !SelectingFolder}" /> |
||||
|
|
||||
|
<ListBox Margin="0 0 5 5" BorderBrush="Transparent" x:Name="QuickLinks" Items="{Binding QuickLinks}" |
||||
|
SelectedIndex="{Binding QuickLinksSelectedIndex}" |
||||
|
DockPanel.Dock="Left" Focusable="False"> |
||||
|
<ListBox.ItemTemplate> |
||||
|
<DataTemplate> |
||||
|
<StackPanel Spacing="4" Orientation="Horizontal" Background="Transparent"> |
||||
|
<DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/> |
||||
|
<TextBlock Text="{Binding DisplayName}"/> |
||||
|
</StackPanel> |
||||
|
</DataTemplate> |
||||
|
</ListBox.ItemTemplate> |
||||
|
</ListBox> |
||||
|
<DockPanel Grid.IsSharedSizeScope="True"> |
||||
|
<Grid DockPanel.Dock="Top" Margin="15 5 0 0" HorizontalAlignment="Stretch"> |
||||
|
<Grid.ColumnDefinitions> |
||||
|
<ColumnDefinition Width="20" SharedSizeGroup="Icon" /> |
||||
|
<ColumnDefinition Width="16" SharedSizeGroup="Splitter" /> |
||||
|
<ColumnDefinition Width="400" 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" /> |
||||
|
<TextBlock Grid.Column="2" Text="Name" /> |
||||
|
<GridSplitter Grid.Column="3" /> |
||||
|
<TextBlock Grid.Column="4" Text="Date Modified" /> |
||||
|
<GridSplitter Grid.Column="5" /> |
||||
|
<TextBlock Grid.Column="6" Text="Type" /> |
||||
|
<GridSplitter Grid.Column="7" /> |
||||
|
<TextBlock Grid.Column="8" Text="Size" /> |
||||
|
</Grid> |
||||
|
<ListBox x:Name="Files" |
||||
|
VirtualizationMode="Simple" |
||||
|
Items="{Binding Items}" |
||||
|
Margin="0 5" |
||||
|
SelectionMode="{Binding SelectionMode}" |
||||
|
SelectedItems="{Binding SelectedItems}" |
||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> |
||||
|
<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> |
||||
|
<DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/> |
||||
|
<TextBlock Grid.Column="2" Text="{Binding DisplayName}"/> |
||||
|
<TextBlock Grid.Column="4" Text="{Binding Modified}" /> |
||||
|
<TextBlock Grid.Column="6" Text="{Binding Type}" /> |
||||
|
<TextBlock Grid.Column="8"> |
||||
|
<TextBlock.Text> |
||||
|
<Binding Path="Size"> |
||||
|
<Binding.Converter> |
||||
|
<dialogs:FileSizeStringConverter/> |
||||
|
</Binding.Converter> |
||||
|
</Binding> |
||||
|
</TextBlock.Text> |
||||
|
</TextBlock> |
||||
|
</Grid> |
||||
|
</DataTemplate> |
||||
|
</ListBox.ItemTemplate> |
||||
|
</ListBox> |
||||
|
</DockPanel> |
||||
|
</DockPanel> |
||||
|
</ControlTemplate> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
</Styles> |
||||
@ -1,44 +1,102 @@ |
|||||
<Style xmlns="https://github.com/avaloniaui" |
<Styles xmlns="https://github.com/avaloniaui" |
||||
Selector="DataValidationErrors" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
xmlns:sys="clr-namespace:System;assembly=netstandard"> |
xmlns:sys="using:System"> |
||||
<Design.PreviewWith> |
<Design.PreviewWith> |
||||
<Border Padding="20"> |
<Border Padding="20"> |
||||
<TextBox Text="Sample"> |
<StackPanel Spacing="20"> |
||||
<DataValidationErrors.Error> |
<TextBox Text="Sample"> |
||||
<sys:Exception/> |
<DataValidationErrors.Error> |
||||
</DataValidationErrors.Error> |
<sys:Exception /> |
||||
</TextBox> |
</DataValidationErrors.Error> |
||||
|
</TextBox> |
||||
|
<TextBox Text="Sample"> |
||||
|
<TextBox.Styles> |
||||
|
<Style Selector="DataValidationErrors"> |
||||
|
<Setter Property="Template" Value="{DynamicResource TooltipDataValidationContentTemplate}" /> |
||||
|
<Setter Property="ErrorTemplate" Value="{DynamicResource TooltipDataValidationErrorTemplate}" /> |
||||
|
</Style> |
||||
|
</TextBox.Styles> |
||||
|
<DataValidationErrors.Error> |
||||
|
<sys:Exception /> |
||||
|
</DataValidationErrors.Error> |
||||
|
</TextBox> |
||||
|
</StackPanel> |
||||
</Border> |
</Border> |
||||
</Design.PreviewWith> |
</Design.PreviewWith> |
||||
|
|
||||
<Setter Property="Template"> |
<Style Selector="DataValidationErrors"> |
||||
<ControlTemplate> |
<Style.Resources> |
||||
<DockPanel LastChildFill="True"> |
<DataTemplate x:Key="InlineDataValidationErrorTemplate"> |
||||
<ContentControl Margin="0 4 0 0" |
<ItemsControl Items="{Binding}"> |
||||
DockPanel.Dock="Bottom" |
<ItemsControl.ItemTemplate> |
||||
ContentTemplate="{TemplateBinding ErrorTemplate}" |
<DataTemplate> |
||||
DataContext="{TemplateBinding Owner}" |
<TextBlock Foreground="{DynamicResource SystemControlErrorTextForegroundBrush}" |
||||
Content="{Binding (DataValidationErrors.Errors)}" |
Text="{Binding}" |
||||
IsVisible="{Binding (DataValidationErrors.HasErrors)}" /> |
TextWrapping="Wrap" /> |
||||
<ContentPresenter |
</DataTemplate> |
||||
Name="PART_ContentPresenter" |
</ItemsControl.ItemTemplate> |
||||
Background="{TemplateBinding Background}" |
</ItemsControl> |
||||
BorderThickness="{TemplateBinding BorderThickness}" |
</DataTemplate> |
||||
ContentTemplate="{TemplateBinding ContentTemplate}" |
<ControlTemplate x:Key="InlineDataValidationContentTemplate" TargetType="DataValidationErrors"> |
||||
Content="{TemplateBinding Content}" |
<DockPanel LastChildFill="True"> |
||||
Padding="{TemplateBinding Padding}" /> |
<ContentControl x:Name="InlineDataValidationContentControl" |
||||
</DockPanel> |
Margin="0,4,0,0" |
||||
</ControlTemplate> |
Content="{Binding (DataValidationErrors.Errors)}" |
||||
</Setter> |
ContentTemplate="{TemplateBinding ErrorTemplate}" |
||||
<Setter Property="ErrorTemplate"> |
DataContext="{TemplateBinding Owner}" |
||||
<DataTemplate> |
DockPanel.Dock="Bottom" |
||||
<ItemsControl Items="{Binding}"> |
IsVisible="{Binding (DataValidationErrors.HasErrors)}" /> |
||||
<ItemsControl.ItemTemplate> |
<ContentPresenter Name="PART_ContentPresenter" |
||||
<DataTemplate> |
Padding="{TemplateBinding Padding}" |
||||
<TextBlock Text="{Binding }" Foreground="{DynamicResource SystemControlErrorTextForegroundBrush}" TextWrapping="Wrap" /> |
Background="{TemplateBinding Background}" |
||||
</DataTemplate> |
BorderThickness="{TemplateBinding BorderThickness}" |
||||
</ItemsControl.ItemTemplate> |
Content="{TemplateBinding Content}" |
||||
</ItemsControl> |
ContentTemplate="{TemplateBinding ContentTemplate}" /> |
||||
</DataTemplate> |
</DockPanel> |
||||
</Setter> |
</ControlTemplate> |
||||
</Style> |
|
||||
|
<DataTemplate x:Key="TooltipDataValidationErrorTemplate"> |
||||
|
<Panel Name="PART_InlineErrorTemplatePanel" Background="Transparent"> |
||||
|
<Panel.Styles> |
||||
|
<Style Selector="Panel#PART_InlineErrorTemplatePanel"> |
||||
|
<Setter Property="Margin" Value="8,0" /> |
||||
|
</Style> |
||||
|
<Style Selector="Panel#PART_InlineErrorTemplatePanel ToolTip"> |
||||
|
<Setter Property="BorderBrush" Value="{DynamicResource SystemControlErrorTextForegroundBrush}" /> |
||||
|
</Style> |
||||
|
<Style Selector="Panel#PART_InlineErrorTemplatePanel ToolTip TextBlock"> |
||||
|
<Setter Property="TextWrapping" Value="Wrap" /> |
||||
|
</Style> |
||||
|
</Panel.Styles> |
||||
|
<ToolTip.Tip> |
||||
|
<ItemsControl Items="{Binding}" /> |
||||
|
</ToolTip.Tip> |
||||
|
<Path Width="14" |
||||
|
Height="14" |
||||
|
Data="M14,7 A7,7 0 0,0 0,7 M0,7 A7,7 0 1,0 14,7 M7,3l0,5 M7,9l0,2" |
||||
|
Stroke="{DynamicResource SystemControlErrorTextForegroundBrush}" |
||||
|
StrokeThickness="2" /> |
||||
|
</Panel> |
||||
|
</DataTemplate> |
||||
|
<ControlTemplate x:Key="TooltipDataValidationContentTemplate" TargetType="DataValidationErrors"> |
||||
|
<DockPanel LastChildFill="True"> |
||||
|
<ContentControl Content="{Binding (DataValidationErrors.Errors)}" |
||||
|
ContentTemplate="{TemplateBinding ErrorTemplate}" |
||||
|
DataContext="{TemplateBinding Owner}" |
||||
|
DockPanel.Dock="Right" |
||||
|
IsVisible="{Binding (DataValidationErrors.HasErrors)}" /> |
||||
|
<ContentPresenter Name="PART_ContentPresenter" |
||||
|
Padding="{TemplateBinding Padding}" |
||||
|
Background="{TemplateBinding Background}" |
||||
|
BorderBrush="{TemplateBinding BorderBrush}" |
||||
|
BorderThickness="{TemplateBinding BorderThickness}" |
||||
|
Content="{TemplateBinding Content}" |
||||
|
ContentTemplate="{TemplateBinding ContentTemplate}" /> |
||||
|
</DockPanel> |
||||
|
</ControlTemplate> |
||||
|
</Style.Resources> |
||||
|
|
||||
|
<Setter Property="Template" Value="{StaticResource InlineDataValidationContentTemplate}" /> |
||||
|
<Setter Property="ErrorTemplate" Value="{StaticResource InlineDataValidationErrorTemplate}" /> |
||||
|
</Style> |
||||
|
</Styles> |
||||
|
|||||
@ -0,0 +1,324 @@ |
|||||
|
<Styles xmlns="https://github.com/avaloniaui" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:dialogs="clr-namespace:Avalonia.Dialogs;assembly=Avalonia.Dialogs"> |
||||
|
<Style Selector="dialogs|ManagedFileChooser"> |
||||
|
<Style.Resources> |
||||
|
<ResourceDictionary> |
||||
|
<GradientStops x:Key="IconRes.FolderBackGradientStops"> |
||||
|
</GradientStops> |
||||
|
<GradientStops x:Key="IconRes.FolderFrontGradientStops"> |
||||
|
<GradientStop Offset="0" Color="#FFFFDA6F"/> |
||||
|
<GradientStop Offset="1" Color="#FFFEC326"/> |
||||
|
</GradientStops> |
||||
|
<DrawingGroup x:Key="LevelUp"> |
||||
|
<GeometryDrawing Brush="#00FFFFFF" Geometry="F1M16,16L0,16 0,0 16,0z" /> |
||||
|
<GeometryDrawing Brush="#FFF6F6F6" Geometry="F1M14.5,0L6.39,0 5.39,2 2.504,2C1.677,2,1,2.673,1,3.5L1,10.582 1,10.586 1,15.414 3,13.414 3,16 7,16 7,13.414 9,15.414 9,13 14.5,13C15.327,13,16,12.327,16,11.5L16,1.5C16,0.673,15.327,0,14.5,0" /> |
||||
|
<GeometryDrawing Brush="#FFDCB679" Geometry="F1M14,3L7.508,3 8.008,2 8.012,2 14,2z M14.5,1L7.008,1 6.008,3 2.504,3C2.227,3,2,3.224,2,3.5L2,9.582 4.998,6.586 9,10.586 9,12 14.5,12C14.775,12,15,11.776,15,11.5L15,1.5C15,1.224,14.775,1,14.5,1" /> |
||||
|
<GeometryDrawing Brush="#FF00529C" Geometry="F1M8,11L5,8 2,11 2,13 4,11 4,15 6,15 6,11 8,13z" /> |
||||
|
<GeometryDrawing Brush="#FFF0EFF1" Geometry="F1M8.0001,1.9996L7.5001,3.0006 14.0001,3.0006 14.0001,1.9996z" /> |
||||
|
</DrawingGroup> |
||||
|
<dialogs:ResourceSelectorConverter x:Key="Icons"> |
||||
|
<DrawingGroup x:Key="Icon_Folder"> |
||||
|
<GeometryDrawing Geometry="M 0 0 L 16 16"/> |
||||
|
<GeometryDrawing Geometry="M 0 3 C 0,1 0,1 2,1 L 5 1 C 5.5,1 6,1 6.5,1.5 L 8 3 L 14 3 C 16,3 16,3 16,5 |
||||
|
L 16,12 C 16,14 16,14 14,14 |
||||
|
L 2,14 C 0,14 0,14 0,12 Z"> |
||||
|
<GeometryDrawing.Brush> |
||||
|
<LinearGradientBrush StartPoint="1,4" EndPoint="23,20"> |
||||
|
<GradientStop Offset="0" Color="#FFFFC018"/> |
||||
|
<GradientStop Offset="1" Color="#FFDFA32D"/> |
||||
|
</LinearGradientBrush> |
||||
|
</GeometryDrawing.Brush> |
||||
|
</GeometryDrawing> |
||||
|
<GeometryDrawing Geometry="M 0 4.5 L 8 4.5 L 8 9 L 0 9 Z"> |
||||
|
<GeometryDrawing.Brush> |
||||
|
<LinearGradientBrush StartPoint="0,4.5" EndPoint="0,5"> |
||||
|
<GradientStop Offset="0" Color="#00D7A018"/> |
||||
|
<GradientStop Offset="1" Color="#7FD7A018"/> |
||||
|
</LinearGradientBrush> |
||||
|
</GeometryDrawing.Brush> |
||||
|
</GeometryDrawing> |
||||
|
<GeometryDrawing Geometry="M 0 9 C 0,5 0,5 2,5 L 5 5 C 5.5,5 6,5 6.5,4.75 L 8 4 L 14 4 C 16,4 16,4 16,6 |
||||
|
L 16,11 C 16,13 16,13 14,13 |
||||
|
L 2,13 C 0,13 0,13 0,11 Z"> |
||||
|
<GeometryDrawing.Brush> |
||||
|
<LinearGradientBrush StartPoint="1,6" EndPoint="23,19"> |
||||
|
<GradientStop Offset="0" Color="#FFFFE69D"/> |
||||
|
<GradientStop Offset="1" Color="#FFFFC937"/> |
||||
|
</LinearGradientBrush> |
||||
|
</GeometryDrawing.Brush> |
||||
|
</GeometryDrawing> |
||||
|
<GeometryDrawing Geometry="M 0 9 C 0,5 0,5 2,5 L 5 5 C 5.5,5 6,5 6.5,4.75 L 8 4 L 14 4 |
||||
|
L 8 4.25 C 6,5.25 5.5,5.25 5.125,5.25 L 2 5.25 C 0,5.25 0,5.25 0,9.25 z" Brush="#7FFFFFFF"/> |
||||
|
</DrawingGroup> |
||||
|
<DrawingGroup x:Key="Icon_File"> |
||||
|
<GeometryDrawing Geometry="M 0 0 L 16 16"/> |
||||
|
<GeometryDrawing Geometry="M 2 0 L 10 0 L 14 4 L 14 16 L 2 16 Z" Brush="#FF797774"/> |
||||
|
<GeometryDrawing Geometry="M 3 1 L 9.7 1 L 13 4.3 L 13 15 L 3 15 Z" Brush="#FFFAFAFA"/> |
||||
|
<GeometryDrawing Geometry="L 9 1 L 9 5 L 14 5 L 14 4 L 10 4 L 10 1 Z" Brush="#FF797774"/> |
||||
|
</DrawingGroup> |
||||
|
<DrawingGroup x:Key="Icon_Volume"> |
||||
|
<GeometryDrawing Geometry="M 0 0 L 16 16"/> |
||||
|
<GeometryDrawing Geometry="M 4 5 L 12 5 L 14.5 7.5 C 15,8 15,8 15,9 L 1 9 C 1,8 1,8 1.5 7.5 Z" Brush="#FFE1E3E6"/> |
||||
|
<GeometryDrawing Geometry="M 12 5 L 14.5 7.5 C 15,8 15,8 15,9 L 10 9 L 10 5 Z"> |
||||
|
<GeometryDrawing.Brush> |
||||
|
<LinearGradientBrush StartPoint="12,5" EndPoint="11.5,5.5"> |
||||
|
<GradientStop Offset="0" Color="#FFCDCFD1"/> |
||||
|
<GradientStop Offset="1" Color="#00CDCFD1"/> |
||||
|
</LinearGradientBrush> |
||||
|
</GeometryDrawing.Brush> |
||||
|
</GeometryDrawing> |
||||
|
<GeometryDrawing Geometry="M 4 5 L 1.5 7.5 C 1,8 1,8 1,9 L 4 9 L 6 9 L 6 5 Z"> |
||||
|
<GeometryDrawing.Brush> |
||||
|
<LinearGradientBrush StartPoint="4,5" EndPoint="4.5,5.5"> |
||||
|
<GradientStop Offset="0" Color="#FFCDCFD1"/> |
||||
|
<GradientStop Offset="1" Color="#00CDCFD1"/> |
||||
|
</LinearGradientBrush> |
||||
|
</GeometryDrawing.Brush> |
||||
|
</GeometryDrawing> |
||||
|
<GeometryDrawing Geometry="M 1 9 C 1,8 1,8 2,8 L 14 8 |
||||
|
C 15,8 15,8 15,9 L 15 11 |
||||
|
C 15,12 15,12 14,12 L 2 12 |
||||
|
C 1,12 1,12 1,11 Z"> |
||||
|
<GeometryDrawing.Brush> |
||||
|
<LinearGradientBrush StartPoint="0,8" EndPoint="0,12"> |
||||
|
<GradientStop Offset="0" Color="#FF737374"/> |
||||
|
<GradientStop Offset="1" Color="#FFA8A8A8"/> |
||||
|
</LinearGradientBrush> |
||||
|
</GeometryDrawing.Brush> |
||||
|
</GeometryDrawing> |
||||
|
<GeometryDrawing Geometry="M 2 9 C 2,8 2,8 3,8 L 13 8 |
||||
|
C 14,8 14,8 14,9 L 14 10 |
||||
|
C 14,11 14,11 13,11 L 3 11 |
||||
|
C 2,11 2,11 2,10 Z"> |
||||
|
<GeometryDrawing.Brush> |
||||
|
<LinearGradientBrush StartPoint="0,8" EndPoint="0,11"> |
||||
|
<GradientStop Offset="0" Color="#FF333333"/> |
||||
|
<GradientStop Offset="1" Color="#FF5A5A5A"/> |
||||
|
</LinearGradientBrush> |
||||
|
</GeometryDrawing.Brush> |
||||
|
</GeometryDrawing> |
||||
|
<GeometryDrawing> |
||||
|
<GeometryDrawing.Geometry> |
||||
|
<EllipseGeometry Rect="2.5,8.5,2,2"/> |
||||
|
</GeometryDrawing.Geometry> |
||||
|
<GeometryDrawing.Brush> |
||||
|
<RadialGradientBrush GradientOrigin="3.5,9.5" Center="3.5,9.5"> |
||||
|
<GradientStop Offset="0.8" Color="#4001FF01"/> |
||||
|
<GradientStop Offset="1" Color="#0001FF01"/> |
||||
|
</RadialGradientBrush> |
||||
|
</GeometryDrawing.Brush> |
||||
|
</GeometryDrawing> |
||||
|
<GeometryDrawing> |
||||
|
<GeometryDrawing.Geometry> |
||||
|
<EllipseGeometry Rect="3,9,1,1"/> |
||||
|
</GeometryDrawing.Geometry> |
||||
|
<GeometryDrawing.Brush> |
||||
|
<RadialGradientBrush GradientOrigin="3.5,9.5" Center="3.25,9.75"> |
||||
|
<GradientStop Offset="0" Color="#FFB6FFB6"/> |
||||
|
<GradientStop Offset="1" Color="#FF01FF01"/> |
||||
|
</RadialGradientBrush> |
||||
|
</GeometryDrawing.Brush> |
||||
|
</GeometryDrawing> |
||||
|
<GeometryDrawing Geometry="M 3.23483495705 9.76516504295 A 0.375,0.375 180 1 0 3.76516504295,9.23483495705 A 0.4375,0.4375 135 0 1 3.23483495705,9.76516504295 Z" Brush="#FF00B300"/> |
||||
|
</DrawingGroup> |
||||
|
</dialogs:ResourceSelectorConverter> |
||||
|
</ResourceDictionary> |
||||
|
</Style.Resources> |
||||
|
<Setter Property="Template"> |
||||
|
<ControlTemplate> |
||||
|
<DockPanel> |
||||
|
<ListBox x:Name="QuickLinks" DockPanel.Dock="Left" Items="{Binding QuickLinks}" SelectedIndex="{Binding QuickLinksSelectedIndex}" Focusable="False"> |
||||
|
<ListBox.ItemTemplate> |
||||
|
<DataTemplate> |
||||
|
<StackPanel Spacing="4" Orientation="Horizontal" Background="Transparent"> |
||||
|
<DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/> |
||||
|
<TextBlock Text="{Binding DisplayName}"/> |
||||
|
</StackPanel> |
||||
|
</DataTemplate> |
||||
|
</ListBox.ItemTemplate> |
||||
|
</ListBox> |
||||
|
<DockPanel x:Name="NavBar" DockPanel.Dock="Top" Margin="8,5,8,0" VerticalAlignment="Center"> |
||||
|
<Rectangle Fill="{DynamicResource SystemControlHighlightAltBaseMediumLowBrush}" Height="1" Margin="0,5,0,0" DockPanel.Dock="Bottom"/> |
||||
|
<DockPanel Margin="4,0"> |
||||
|
<Button Command="{Binding GoUp}" DockPanel.Dock="Left"> |
||||
|
<Path Data="M 0 7 L 7 0 L 14 7 M 7 0 L 7 16" Stroke="{Binding $parent[Button].Foreground}" StrokeThickness="1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,1,0,-1"/> |
||||
|
</Button> |
||||
|
<TextBox x:Name="Location" Text="{Binding Location}"> |
||||
|
<TextBox.KeyBindings> |
||||
|
<KeyBinding Command="{Binding EnterPressed}" Gesture="Enter"/> |
||||
|
</TextBox.KeyBindings> |
||||
|
</TextBox> |
||||
|
</DockPanel> |
||||
|
</DockPanel> |
||||
|
<DockPanel Margin="8,0,8,5" DockPanel.Dock="Bottom"> |
||||
|
<Rectangle Fill="{DynamicResource SystemControlHighlightAltBaseMediumLowBrush}" Height="1" Margin="0,0,0,5" DockPanel.Dock="Top"/> |
||||
|
<DockPanel Margin="4,0"> |
||||
|
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,4"> |
||||
|
<ComboBox DockPanel.Dock="Right" |
||||
|
IsVisible="{Binding ShowFilters}" |
||||
|
Items="{Binding Filters}" |
||||
|
SelectedItem="{Binding SelectedFilter}" /> |
||||
|
<TextBox Text="{Binding FileName}" Watermark="File name" IsVisible="{Binding !SelectingFolder}" /> |
||||
|
</DockPanel> |
||||
|
<CheckBox IsChecked="{Binding ShowHiddenFiles}" Content="Show hidden files" DockPanel.Dock="Left"/> |
||||
|
<UniformGrid x:Name="Finalize" HorizontalAlignment="Right" Rows="1"> |
||||
|
<Button Command="{Binding Ok}">OK</Button> |
||||
|
<Button Command="{Binding Cancel}">Cancel</Button> |
||||
|
</UniformGrid> |
||||
|
</DockPanel> |
||||
|
</DockPanel> |
||||
|
|
||||
|
<DockPanel Grid.IsSharedSizeScope="True"> |
||||
|
<Grid DockPanel.Dock="Top" Margin="15 5 0 0" HorizontalAlignment="Stretch"> |
||||
|
<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> |
||||
|
<Grid.Styles> |
||||
|
<Style Selector="GridSplitter"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SystemControlHighlightAltBaseMediumLowBrush}"/> |
||||
|
<Setter Property="Template"> |
||||
|
<ControlTemplate> |
||||
|
<Border VerticalAlignment="Stretch" BorderThickness="0" Background="#01000000"> |
||||
|
<Rectangle Width="1" VerticalAlignment="Stretch" Fill="{TemplateBinding Background}"/> |
||||
|
</Border> |
||||
|
</ControlTemplate> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
</Grid.Styles> |
||||
|
<GridSplitter Grid.Column="1" /> |
||||
|
<TextBlock Grid.Column="2" Text="Name" /> |
||||
|
<GridSplitter Grid.Column="3" /> |
||||
|
<TextBlock Grid.Column="4" Text="Date Modified" /> |
||||
|
<GridSplitter Grid.Column="5" /> |
||||
|
<TextBlock Grid.Column="6" Text="Type" /> |
||||
|
<GridSplitter Grid.Column="7" /> |
||||
|
<TextBlock Grid.Column="8" Text="Size" /> |
||||
|
</Grid> |
||||
|
<ListBox x:Name="Files" |
||||
|
VirtualizationMode="Simple" |
||||
|
Items="{Binding Items}" |
||||
|
Margin="0 5" |
||||
|
SelectionMode="{Binding SelectionMode}" |
||||
|
SelectedItems="{Binding SelectedItems}" |
||||
|
Background="Transparent" |
||||
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> |
||||
|
<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> |
||||
|
<DrawingPresenter Width="16" Height="16" Drawing="{Binding IconKey, Converter={StaticResource Icons}}"/> |
||||
|
<TextBlock Grid.Column="2" Text="{Binding DisplayName}"/> |
||||
|
<TextBlock Grid.Column="4" Text="{Binding Modified}" /> |
||||
|
<TextBlock Grid.Column="6" Text="{Binding Type}" /> |
||||
|
<TextBlock Grid.Column="8"> |
||||
|
<TextBlock.Text> |
||||
|
<Binding Path="Size"> |
||||
|
<Binding.Converter> |
||||
|
<dialogs:FileSizeStringConverter/> |
||||
|
</Binding.Converter> |
||||
|
</Binding> |
||||
|
</TextBlock.Text> |
||||
|
</TextBlock> |
||||
|
</Grid> |
||||
|
</DataTemplate> |
||||
|
</ListBox.ItemTemplate> |
||||
|
</ListBox> |
||||
|
</DockPanel> |
||||
|
</DockPanel> |
||||
|
</ControlTemplate> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
|
||||
|
|
||||
|
<Style Selector="dialogs|ManagedFileChooser /template/ ListBox#QuickLinks"> |
||||
|
<Setter Property="Margin" Value="0"/> |
||||
|
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundChromeMediumBrush}"/> |
||||
|
<Setter Property="BorderThickness" Value="0"/> |
||||
|
<Setter Property="Width" Value="240"/> |
||||
|
<Setter Property="Padding" Value="0,20"/> |
||||
|
<Setter Property="Template"> |
||||
|
<ControlTemplate> |
||||
|
<Border Name="border" BoxShadow="inset -6 0 3 -3 #20000000" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> |
||||
|
<ScrollViewer Name="PART_ScrollViewer" HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}" VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"> |
||||
|
<ItemsPresenter Name="PART_ItemsPresenter" |
||||
|
Items="{TemplateBinding Items}" |
||||
|
ItemsPanel="{TemplateBinding ItemsPanel}" |
||||
|
ItemTemplate="{TemplateBinding ItemTemplate}" |
||||
|
Margin="{TemplateBinding Padding}" |
||||
|
VirtualizationMode="{TemplateBinding VirtualizationMode}"/> |
||||
|
</ScrollViewer> |
||||
|
</Border> |
||||
|
</ControlTemplate> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
<Style Selector="dialogs|ManagedFileChooser /template/ ListBox#QuickLinks ListBoxItem"> |
||||
|
<Setter Property="Height" Value="32"/> |
||||
|
<Setter Property="Padding" Value="30,6"/> |
||||
|
<Setter Property="Template"> |
||||
|
<ControlTemplate> |
||||
|
<Border x:Name="LayoutRoot" CornerRadius="2" Margin="10,0"> |
||||
|
<Panel> |
||||
|
<Border x:Name="SelectedLine" HorizontalAlignment="Left" Margin="2,6" CornerRadius="0.5" Width="3" Background="{DynamicResource SystemControlHighlightAccentBrush}" IsVisible="{TemplateBinding IsSelected}"/> |
||||
|
<ContentPresenter Name="PART_ContentPresenter" |
||||
|
Background="Transparent" |
||||
|
BorderBrush="Transparent" |
||||
|
BorderThickness="0" |
||||
|
ContentTemplate="{TemplateBinding ContentTemplate}" |
||||
|
Content="{TemplateBinding Content}" |
||||
|
Padding="{TemplateBinding Padding}" |
||||
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
||||
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/> |
||||
|
|
||||
|
</Panel> |
||||
|
</Border> |
||||
|
</ControlTemplate> |
||||
|
</Setter> |
||||
|
</Style> |
||||
|
<Style Selector="dialogs|ManagedFileChooser /template/ ListBox#QuickLinks ListBoxItem:pointerover /template/ Border#LayoutRoot"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundAltMediumBrush}"/> |
||||
|
</Style> |
||||
|
<Style Selector="dialogs|ManagedFileChooser /template/ ListBox#QuickLinks ListBoxItem:selected /template/ Border#LayoutRoot"> |
||||
|
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundAltMediumHighBrush}"/> |
||||
|
</Style> |
||||
|
<Style Selector="dialogs|ManagedFileChooser /template/ DockPanel#NavBar Button, |
||||
|
dialogs|ManagedFileChooser /template/ DockPanel#NavBar TextBox"> |
||||
|
<Setter Property="Height" Value="30"/> |
||||
|
</Style> |
||||
|
<Style Selector="dialogs|ManagedFileChooser /template/ DockPanel#NavBar Button"> |
||||
|
<Setter Property="VerticalAlignment" Value="Stretch"/> |
||||
|
<Setter Property="Width" Value="40"/> |
||||
|
<Setter Property="Margin" Value="0,0,8,0"/> |
||||
|
<Setter Property="BorderThickness" Value="0"/> |
||||
|
</Style> |
||||
|
<Style Selector="dialogs|ManagedFileChooser /template/ DockPanel#NavBar Button:not(:pointerover):not(:pressed)"> |
||||
|
<Setter Property="Background" Value="Transparent"/> |
||||
|
</Style> |
||||
|
|
||||
|
<Style Selector="dialogs|ManagedFileChooser /template/ UniformGrid#Finalize > Button"> |
||||
|
<Setter Property="HorizontalContentAlignment" Value="Center"/> |
||||
|
<Setter Property="HorizontalAlignment" Value="Stretch"/> |
||||
|
<Setter Property="Margin" Value="4,0,0,0"/> |
||||
|
</Style> |
||||
|
<Style Selector="dialogs|ManagedFileChooser /template/ UniformGrid#Finalize > Button /template/ ContentPresenter#PART_ContentPresenter"> |
||||
|
<Setter Property="HorizontalAlignment" Value="Stretch"/> |
||||
|
</Style> |
||||
|
</Styles> |
||||
@ -0,0 +1,43 @@ |
|||||
|
using System; |
||||
|
using System.Globalization; |
||||
|
using Avalonia.Media; |
||||
|
using Avalonia.Media.TextFormatting; |
||||
|
using Avalonia.UnitTests; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Avalonia.Skia.UnitTests.Media.TextFormatting |
||||
|
{ |
||||
|
public class TextShaperTests |
||||
|
{ |
||||
|
[Fact] |
||||
|
public void Should_Form_Clusters_For_BreakPairs() |
||||
|
{ |
||||
|
using (Start()) |
||||
|
{ |
||||
|
var text = "\n\r\n".AsMemory(); |
||||
|
|
||||
|
var glyphRun = TextShaper.Current.ShapeText( |
||||
|
text, |
||||
|
Typeface.Default, |
||||
|
12, |
||||
|
CultureInfo.CurrentCulture); |
||||
|
|
||||
|
Assert.Equal(glyphRun.Characters.Length, text.Length); |
||||
|
Assert.Equal(glyphRun.GlyphClusters.Length, text.Length); |
||||
|
Assert.Equal(0, glyphRun.GlyphClusters[0]); |
||||
|
Assert.Equal(1, glyphRun.GlyphClusters[1]); |
||||
|
Assert.Equal(1, glyphRun.GlyphClusters[2]); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private static IDisposable Start() |
||||
|
{ |
||||
|
var disposable = UnitTestApplication.Start(TestServices.MockPlatformRenderInterface |
||||
|
.With(renderInterface: new PlatformRenderInterface(null), |
||||
|
textShaperImpl: new TextShaperImpl(), |
||||
|
fontManagerImpl: new CustomFontManagerImpl())); |
||||
|
|
||||
|
return disposable; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue