-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
386 additions
and
732 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<UserControl | ||
x:Class="Files.UserControls.DataGridHeader" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:ciao="using:Microsoft.Toolkit.Uwp.UI" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:Files.UserControls" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
d:DesignHeight="300" | ||
d:DesignWidth="400" | ||
mc:Ignorable="d"> | ||
<UserControl.Resources> | ||
<Style x:Name="HeaderButtonStyle" TargetType="Button"> | ||
<Setter Property="CornerRadius" Value="0" /> | ||
<Setter Property="BorderBrush" Value="Transparent" /> | ||
<Setter Property="HorizontalContentAlignment" Value="Stretch" /> | ||
<Setter Property="Height" Value="34" /> | ||
<Setter Property="HorizontalAlignment" Value="Stretch" /> | ||
<Setter Property="VerticalAlignment" Value="Stretch" /> | ||
<Setter Property="Background"> | ||
<Setter.Value> | ||
<SolidColorBrush Opacity="0" /> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
|
||
<x:String x:Key="SortIconAscending"></x:String> | ||
</UserControl.Resources> | ||
|
||
<Grid> | ||
<Button | ||
Command="{x:Bind Command}" | ||
CommandParameter="{x:Bind CommandParameter}" | ||
IsEnabled="{x:Bind CanBeSorted, Mode=OneWay}" | ||
Style="{StaticResource HeaderButtonStyle}"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
<TextBlock Style="{ThemeResource NavigationViewItemHeaderTextStyle}" Text="{x:Bind Header, Mode=OneWay}" /> | ||
<FontIcon | ||
x:Name="SortIcon" | ||
Grid.Column="1" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
FontFamily="{ThemeResource SymbolThemeFontFamily}" | ||
FontSize="12" | ||
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" | ||
Glyph="{StaticResource SortIconAscending}" | ||
RenderTransformOrigin="0.5, 0.5" | ||
Visibility="Collapsed"> | ||
<FontIcon.RenderTransform> | ||
<RotateTransform /> | ||
</FontIcon.RenderTransform> | ||
</FontIcon> | ||
</Grid> | ||
</Button> | ||
|
||
<VisualStateManager.VisualStateGroups> | ||
<VisualStateGroup x:Name="SortStates"> | ||
<VisualState x:Name="Unsorted" /> | ||
<VisualState x:Name="SortAscending"> | ||
<VisualState.Setters> | ||
<Setter Target="SortIcon.Visibility" Value="Visible" /> | ||
</VisualState.Setters> | ||
<Storyboard> | ||
<DoubleAnimation | ||
Storyboard.TargetName="SortIcon" | ||
Storyboard.TargetProperty="(FontIcon.RenderTransform).(RotateTransform.Angle)" | ||
To="0" | ||
Duration="0:0:0.2" /> | ||
</Storyboard> | ||
</VisualState> | ||
<VisualState x:Name="SortDescending"> | ||
<VisualState.Setters> | ||
<Setter Target="SortIcon.Visibility" Value="Visible" /> | ||
</VisualState.Setters> | ||
<Storyboard> | ||
<DoubleAnimation | ||
Storyboard.TargetName="SortIcon" | ||
Storyboard.TargetProperty="(FontIcon.RenderTransform).(RotateTransform.Angle)" | ||
To="180" | ||
Duration="0:0:0.2" /> | ||
</Storyboard> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateManager.VisualStateGroups> | ||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
using Microsoft.Toolkit.Uwp.UI; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using System.Windows.Input; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.UI.Xaml; | ||
using Windows.UI.Xaml.Controls; | ||
using Windows.UI.Xaml.Controls.Primitives; | ||
using Windows.UI.Xaml.Data; | ||
using Windows.UI.Xaml.Input; | ||
using Windows.UI.Xaml.Media; | ||
using Windows.UI.Xaml.Navigation; | ||
|
||
// Il modello di elemento Controllo utente è documentato all'indirizzo https://go.microsoft.com/fwlink/?LinkId=234236 | ||
|
||
namespace Files.UserControls | ||
{ | ||
public sealed partial class DataGridHeader : UserControl, INotifyPropertyChanged | ||
{ | ||
public ICommand Command { get; set; } | ||
public object CommandParameter { get; set; } | ||
|
||
private string header; | ||
|
||
public string Header | ||
{ | ||
get { return header; } | ||
set | ||
{ | ||
if (value != header) | ||
{ | ||
header = value; | ||
NotifyPropertyChanged(nameof(Header)); | ||
} | ||
} | ||
} | ||
|
||
private bool canBeSorted = true; | ||
|
||
public bool CanBeSorted | ||
{ | ||
get { return canBeSorted; } | ||
set | ||
{ | ||
if (value != canBeSorted) | ||
{ | ||
canBeSorted = value; | ||
NotifyPropertyChanged(nameof(CanBeSorted)); | ||
} | ||
} | ||
} | ||
|
||
private SortDirection? columnSortOption; | ||
|
||
public SortDirection? ColumnSortOption | ||
{ | ||
get { return columnSortOption; } | ||
set | ||
{ | ||
if (value != columnSortOption) | ||
{ | ||
switch (value) | ||
{ | ||
case SortDirection.Ascending: | ||
VisualStateManager.GoToState(this, "SortAscending", true); | ||
break; | ||
case SortDirection.Descending: | ||
VisualStateManager.GoToState(this, "SortDescending", true); | ||
break; | ||
default: | ||
VisualStateManager.GoToState(this, "Unsorted", true); | ||
break; | ||
} | ||
columnSortOption = value; | ||
} | ||
} | ||
} | ||
|
||
public DataGridHeader() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
public event PropertyChangedEventHandler PropertyChanged; | ||
|
||
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "") | ||
{ | ||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.