Skip to content

Commit 572b77c

Browse files
committed
Dim items of GridView layout on Cut
1 parent 6cce7bb commit 572b77c

File tree

2 files changed

+30
-4
lines changed

2 files changed

+30
-4
lines changed

Files UWP/Interacts/Interaction.cs

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,7 @@ public async void RenameItem_Click(object sender, RoutedEventArgs e)
899899

900900

901901
public List<DataGridRow> dataGridRows = new List<DataGridRow>();
902+
public List<GridViewItem> gridViewItems = new List<GridViewItem>();
902903
public async void CutItem_Click(object sender, RoutedEventArgs e)
903904
{
904905
DataPackage dataPackage = new DataPackage();
@@ -928,11 +929,10 @@ public async void CutItem_Click(object sender, RoutedEventArgs e)
928929
{
929930
if(dataGridRow.GetIndex() == StorItem.RowIndex)
930931
{
931-
Debug.WriteLine(dataGridRow.GetIndex());
932932
(CurrentInstance.accessibleContentFrame.Content as GenericFileBrowser).data.Columns[0].GetCellContent(dataGridRow).Opacity = 0.4;
933933
}
934934
}
935-
var RowPressed = FindParent<DataGridRow>((CurrentInstance.accessibleContentFrame.Content as GenericFileBrowser).data as DependencyObject);
935+
936936
App.pathsToDeleteAfterPaste.Add(StorItem.FilePath);
937937
if (StorItem.FileType != "Folder")
938938
{
@@ -950,11 +950,37 @@ public async void CutItem_Click(object sender, RoutedEventArgs e)
950950
else if (typeof(PageType) == typeof(PhotoAlbum))
951951
{
952952
var CurrentInstance = ItemViewModel<PhotoAlbum>.GetCurrentSelectedTabInstance<ProHome>();
953-
954953
if ((CurrentInstance.accessibleContentFrame.Content as PhotoAlbum).gv.SelectedItems.Count != 0)
955954
{
955+
956+
gridViewItems.Clear();
957+
FindChildren<GridViewItem>(gridViewItems, (CurrentInstance.accessibleContentFrame.Content as PhotoAlbum).PAPageName.Content);
958+
959+
// First, reset GridView items that may be in "cut" command mode
960+
foreach (GridViewItem gridViewItem in gridViewItems)
961+
{
962+
List<Grid> itemContentGrids = new List<Grid>();
963+
FindChildren<Grid>(itemContentGrids, (CurrentInstance.accessibleContentFrame.Content as PhotoAlbum).gv.ContainerFromItem(gridViewItem.Content));
964+
var imageOfItem = itemContentGrids.Find(x => x.Tag.ToString() == "ItemImage");
965+
if (imageOfItem.Opacity < 1)
966+
{
967+
imageOfItem.Opacity = 1;
968+
}
969+
}
970+
956971
foreach (ListedItem StorItem in (type as PhotoAlbum).gv.SelectedItems)
957972
{
973+
foreach (GridViewItem itemToDimForCut in gridViewItems)
974+
{
975+
if ( (CurrentInstance.accessibleContentFrame.Content as PhotoAlbum).gv.Items.IndexOf(itemToDimForCut.Content) == StorItem.RowIndex)
976+
{
977+
List<Grid> itemContentGrids = new List<Grid>();
978+
FindChildren<Grid>(itemContentGrids, (CurrentInstance.accessibleContentFrame.Content as PhotoAlbum).gv.ContainerFromItem(itemToDimForCut.Content));
979+
var imageOfItem = itemContentGrids.Find(x => x.Tag.ToString() == "ItemImage");
980+
imageOfItem.Opacity = 0.4;
981+
}
982+
}
983+
958984
App.pathsToDeleteAfterPaste.Add(StorItem.FilePath);
959985
if (StorItem.FileType != "Folder")
960986
{

Files UWP/PhotoAlbum.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@
482482
<GridView.ItemTemplate>
483483
<DataTemplate x:DataType="local2:ListedItem">
484484
<StackPanel IsRightTapEnabled="True" RightTapped="StackPanel_RightTapped" Width="150" Height="150" Tag="{x:Bind RowIndex}" Orientation="Vertical" Padding="0" ToolTipService.ToolTip="{Binding FileName}" Background="Transparent" Margin="0, 0, 0, 0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
485-
<Grid Width="150" Height="100">
485+
<Grid Tag="ItemImage" Width="150" Height="100">
486486
<Grid Padding="12" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Name="Picture" Visibility="{x:Bind FileIconVis}">
487487
<Image Stretch="Uniform" Source="{x:Bind FileImg}"/>
488488
</Grid>

0 commit comments

Comments
 (0)