Merge pull request #166 from SunboX/list-item-cleanup

removed some complexity, fixed text overflow (item name)
This commit is contained in:
André Fiedler 2017-05-29 22:55:20 +02:00 коммит произвёл GitHub
Родитель a592919092 4b8e8cd0aa
Коммит 56bb273b88
1 изменённых файлов: 125 добавлений и 135 удалений

Просмотреть файл

@ -187,153 +187,143 @@
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Grid HorizontalAlignment="Stretch"> <Grid HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid <Grid
Grid.RowSpan="2" Grid.RowSpan="2"
Height="40" Height="40"
Width="40" Width="40"
Margin="0,0,4,0" Margin="0,0,4,0"
Background="{StaticResource SystemControlHighlightAccentBrush}"> Background="{StaticResource SystemControlHighlightAccentBrush}">
<FontIcon <FontIcon
Glyph="{Binding Converter={StaticResource ContentTypeToIconConverter}}" Glyph="{Binding Converter={StaticResource ContentTypeToIconConverter}}"
FontFamily="Segoe MDL2 Assets" FontFamily="Segoe MDL2 Assets"
FontSize="28" FontSize="28"
VerticalAlignment="Center" VerticalAlignment="Center"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Foreground="White"/> Foreground="White"/>
<Border <Border
Background="#808080" Background="#808080"
Visibility="{Binding Thumbnail, Converter={StaticResource NullToVisibilityConverter}}"> Visibility="{Binding Thumbnail, Converter={StaticResource NullToVisibilityConverter}}">
<Image <Image
Source="{Binding Thumbnail}" Source="{Binding Thumbnail}"
Stretch="UniformToFill"/> Stretch="UniformToFill"/>
</Border> </Border>
</Grid> </Grid>
<TextBlock <TextBlock
Grid.Row="0" Grid.Row="0"
Grid.Column="1" Grid.Column="1"
Text="{Binding Name}" Text="{Binding Name}"
TextWrapping="NoWrap" TextWrapping="NoWrap"
TextTrimming="CharacterEllipsis" /> TextTrimming="CharacterEllipsis"
VerticalAlignment="Top"/>
<StackPanel <StackPanel
Grid.Row="1" Grid.Row="1"
Grid.Column="1" Grid.Column="1"
Orientation="Horizontal"> Orientation="Horizontal">
<TextBlock <TextBlock
Text="{Binding Size, Converter={StaticResource BytesToHumanReadableConverter}}" Text="{Binding Size, Converter={StaticResource BytesToHumanReadableConverter}}"
Foreground="{StaticResource SystemControlForegroundBaseMediumBrush}" Foreground="{StaticResource SystemControlForegroundBaseMediumBrush}"
Margin="0,0,8,0"/> Margin="0,0,8,0"/>
<TextBlock <TextBlock
Text="{Binding LastModified, Converter={StaticResource DateTimeToStringConverter}}" Text="{Binding LastModified, Converter={StaticResource DateTimeToStringConverter}}"
Foreground="{StaticResource SystemControlForegroundBaseMediumBrush}"/> Foreground="{StaticResource SystemControlForegroundBaseMediumBrush}"/>
</StackPanel> </StackPanel>
<interactivity:Interaction.Behaviors> <FontIcon
<core:EventTriggerBehavior EventName="Holding"> Grid.Column="2"
<actions:OpenMenuFlyoutAction /> Grid.RowSpan="2"
</core:EventTriggerBehavior> Glyph="{Binding Converter={StaticResource FavoriteToIconConverter}}"
<core:EventTriggerBehavior EventName="RightTapped"> Margin="10,0,10,0"
<actions:OpenMenuFlyoutAction /> FontFamily="Segoe MDL2 Assets"
</core:EventTriggerBehavior> FontSize="16"
</interactivity:Interaction.Behaviors> VerticalAlignment="Center"
<FlyoutBase.AttachedFlyout> HorizontalAlignment="Center"
<MenuFlyout> Foreground="{StaticResource SystemControlHighlightAccentBrush}"/>
<MenuFlyoutItem
Tag="Rename" <interactivity:Interaction.Behaviors>
x:Uid="Rename_Text" <core:EventTriggerBehavior EventName="Holding">
Text="Rename" <actions:OpenMenuFlyoutAction />
Command="{Binding DataContext.RenameResourceCommand, ElementName=Page}" </core:EventTriggerBehavior>
CommandParameter="{Binding}" <core:EventTriggerBehavior EventName="RightTapped">
Style="{StaticResource MenuFlyoutIconItemStyle}"/> <actions:OpenMenuFlyoutAction />
<MenuFlyoutItem </core:EventTriggerBehavior>
Tag="MoveToFolder" </interactivity:Interaction.Behaviors>
x:Uid="MoveTo_Text"
Text="Move to"
Command="{Binding DataContext.MoveResourceCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"/>
<MenuFlyoutItem
Tag="Delete"
x:Uid="Delete_Text"
Text="Delete"
Command="{Binding DataContext.DeleteResourceCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"/>
<MenuFlyoutItem
Tag="Download"
x:Uid="DownloadAsZip"
Text="Download as ZIP file"
Command="{Binding DataContext.DownloadResourceCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"
Visibility="{Binding Converter={StaticResource IsFileAndNotFolderToVisibilityConverter}, ConverterParameter=true}"/>
<MenuFlyoutItem
Tag="Download"
x:Uid="Download"
Text="Download"
Command="{Binding DataContext.DownloadResourceCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"
Visibility="{Binding Converter={StaticResource IsFileAndNotFolderToVisibilityConverter}}"/>
<MenuFlyoutItem
Tag="SyncFolder"
x:Uid="Synchronize"
Text="{Binding Converter={StaticResource SynchronizeFolderToTextConverter}}"
Command="{Binding DataContext.SynchronizeFolderCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"
Visibility="{Binding Converter={StaticResource IsFileAndNotFolderToVisibilityConverter}, ConverterParameter=true}"/>
<MenuFlyoutItem
Tag="UnSyncFolder"
x:Uid="StopSynchronize"
Text="Stop synchronizing"
Command="{Binding DataContext.StopSynchronizeFolderCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"
Visibility="{Binding Converter={StaticResource IsFolderSyncedConverter}}"/>
<MenuFlyoutItem
Tag="Pin"
x:Uid="PinToStart"
Text="Pin to start"
Command="{Binding DataContext.PinToStartCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"/>
</MenuFlyout>
</FlyoutBase.AttachedFlyout>
</Grid>
<Grid Grid.Column="1"> <FlyoutBase.AttachedFlyout>
<Grid.ColumnDefinitions> <MenuFlyout>
<ColumnDefinition Width="*"></ColumnDefinition> <MenuFlyoutItem
<ColumnDefinition Width="Auto"></ColumnDefinition> Tag="Rename"
</Grid.ColumnDefinitions> x:Uid="Rename_Text"
<FontIcon Text="Rename"
Grid.Column="1" Command="{Binding DataContext.RenameResourceCommand, ElementName=Page}"
Grid.Row="0" CommandParameter="{Binding}"
Glyph="{Binding Converter={StaticResource FavoriteToIconConverter}}" Style="{StaticResource MenuFlyoutIconItemStyle}"/>
Margin="0,0,10,0" <MenuFlyoutItem
FontFamily="Segoe MDL2 Assets" Tag="MoveToFolder"
FontSize="16" x:Uid="MoveTo_Text"
VerticalAlignment="Center" Text="Move to"
HorizontalAlignment="Center" Command="{Binding DataContext.MoveResourceCommand, ElementName=Page}"
Foreground="{StaticResource SystemControlHighlightAccentBrush}"/> CommandParameter="{Binding}"
</Grid> Style="{StaticResource MenuFlyoutIconItemStyle}"/>
<MenuFlyoutItem
Tag="Delete"
x:Uid="Delete_Text"
Text="Delete"
Command="{Binding DataContext.DeleteResourceCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"/>
<MenuFlyoutItem
Tag="Download"
x:Uid="DownloadAsZip"
Text="Download as ZIP file"
Command="{Binding DataContext.DownloadResourceCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"
Visibility="{Binding Converter={StaticResource IsFileAndNotFolderToVisibilityConverter}, ConverterParameter=true}"/>
<MenuFlyoutItem
Tag="Download"
x:Uid="Download"
Text="Download"
Command="{Binding DataContext.DownloadResourceCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"
Visibility="{Binding Converter={StaticResource IsFileAndNotFolderToVisibilityConverter}}"/>
<MenuFlyoutItem
Tag="SyncFolder"
x:Uid="Synchronize"
Text="{Binding Converter={StaticResource SynchronizeFolderToTextConverter}}"
Command="{Binding DataContext.SynchronizeFolderCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"
Visibility="{Binding Converter={StaticResource IsFileAndNotFolderToVisibilityConverter}, ConverterParameter=true}"/>
<MenuFlyoutItem
Tag="UnSyncFolder"
x:Uid="StopSynchronize"
Text="Stop synchronizing"
Command="{Binding DataContext.StopSynchronizeFolderCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"
Visibility="{Binding Converter={StaticResource IsFolderSyncedConverter}}"/>
<MenuFlyoutItem
Tag="Pin"
x:Uid="PinToStart"
Text="Pin to start"
Command="{Binding DataContext.PinToStartCommand, ElementName=Page}"
CommandParameter="{Binding}"
Style="{StaticResource MenuFlyoutIconItemStyle}"/>
</MenuFlyout>
</FlyoutBase.AttachedFlyout>
</Grid> </Grid>
</DataTemplate> </DataTemplate>
</ListView.ItemTemplate> </ListView.ItemTemplate>