Skip to content

Commit 1343312

Browse files
committed
Enable Click of PathBar items
1 parent 278f94f commit 1343312

File tree

4 files changed

+23
-10
lines changed

4 files changed

+23
-10
lines changed

Files UWP/Filesystem/ItemViewModel.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,16 @@ private void Universal_PropertyChanged(object sender, System.ComponentModel.Prop
128128
}
129129
tag = s + @"\";
130130

131-
GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Add(new Microsoft.UI.Xaml.Controls.TabViewItem()
131+
Microsoft.UI.Xaml.Controls.TabViewItem item = new Microsoft.UI.Xaml.Controls.TabViewItem()
132132
{
133133
Header = componentLabel + " >",
134134
Tag = tag,
135135
CornerRadius = new CornerRadius(0),
136136
Style = tabStyleFixed,
137137
FontWeight = weight
138-
});
138+
};
139+
item.Tapped += Item_Tapped;
140+
GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Add(item);
139141
}
140142
else
141143
{
@@ -145,20 +147,29 @@ private void Universal_PropertyChanged(object sender, System.ComponentModel.Prop
145147
tag = tag + part + @"\";
146148
}
147149

148-
GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Add(new Microsoft.UI.Xaml.Controls.TabViewItem()
150+
Microsoft.UI.Xaml.Controls.TabViewItem item = new Microsoft.UI.Xaml.Controls.TabViewItem()
149151
{
150152
Header = componentLabel + " >",
151153
Tag = tag,
152154
CornerRadius = new CornerRadius(0),
153155
Style = tabStyleFixed,
154156
FontWeight = weight
155-
});
157+
};
158+
item.Tapped += Item_Tapped;
159+
GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Add(item);
160+
156161
}
157162
index++;
158163
}
159164
}
160165
}
161166

167+
private void Item_Tapped(object sender, Windows.UI.Xaml.Input.TappedRoutedEventArgs e)
168+
{
169+
var itemTappedTag = (sender as Microsoft.UI.Xaml.Controls.TabViewItem).Tag.ToString();
170+
ItemViewModel<ProHome>.GetCurrentSelectedTabInstance<ProHome>().accessibleContentFrame.Navigate(typeof(GenericFileBrowser), itemTappedTag, new SuppressNavigationTransitionInfo());
171+
}
172+
162173
private void AlwaysPresentCommands_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
163174
{
164175
if(tabInstance.AlwaysPresentCommands.isEnabled == true)

Files UWP/ProHome.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,11 @@
471471
<Grid x:Name="TabContainerGrid" Background="Transparent">
472472
<Grid.ColumnDefinitions>
473473
<ColumnDefinition x:Name="LeftContentColumn" Width="Auto"/>
474-
<ColumnDefinition x:Name="TabColumn" Width="Auto"/>
474+
<ColumnDefinition x:Name="TabColumn" Width="*"/>
475475
<ColumnDefinition Width="*"/>
476476
</Grid.ColumnDefinitions>
477477
<ContentPresenter x:Name="LeftContentPresenter" ContentTemplate="{TemplateBinding LeftCustomContentTemplate}" Content="{TemplateBinding LeftCustomContent}" Grid.Column="0"/>
478-
<primitives:TabViewListView Padding="0" x:Name="TabListView" AllowDrop="{TemplateBinding CanDragDropTabs}" CanReorderItems="{TemplateBinding CanDragDropTabs}" Grid.Column="1" CanDragItems="{TemplateBinding CanDragDropTabs}" ItemTemplate="{TemplateBinding ItemTemplate}" ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}"/>
478+
<primitives:TabViewListView Padding="0" x:Name="TabListView" AllowDrop="{TemplateBinding CanDragDropTabs}" CanReorderItems="{TemplateBinding CanDragDropTabs}" Grid.Column="1" CanDragItems="{TemplateBinding CanDragDropTabs}" ItemTemplate="{TemplateBinding ItemTemplate}" ItemTemplateSelector="{TemplateBinding ItemTemplateSelector}" VerticalAlignment="Stretch"/>
479479
<Grid IsTapEnabled="True" Tapped="ManualPathEntryClickArea_Tapped" Background="Transparent" x:Name="ManualPathEntryClickArea" Grid.Column="2"/>
480480
</Grid>
481481
<ContentPresenter x:Name="TabContentPresenter" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Grid.Row="1"/>
@@ -785,8 +785,8 @@
785785
</StackPanel>
786786
<Grid Padding="5" Grid.Column="1">
787787
<TextBox LostFocus="VisiblePath_LostFocus" Visibility="Collapsed" HorizontalAlignment="Stretch" BorderBrush="DarkGray" Text="{x:Bind PathText.Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Windows10version1809:CornerRadius="2" KeyDown="VisiblePath_TextChanged" Style="{StaticResource TextBoxStyleForPathBar}" BorderThickness="1" x:Name="VisiblePath" FontFamily="Segoe UI" FontWeight="SemiBold" FontSize="14" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Auto" VerticalAlignment="Stretch" Padding="5" PlaceholderText="Enter a path"/>
788-
<Grid Padding="4,1,1,1" HorizontalAlignment="Stretch" BorderBrush="DarkGray" Windows10version1809:CornerRadius="2" BorderThickness="1" x:Name="ClickablePath" ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Auto" VerticalAlignment="Stretch">
789-
<uilib:TabView x:Name="PathViewInteract" SelectionChanged="ClickablePathView_SelectionChanged" VerticalContentAlignment="Stretch" CanDragDropTabs="False" CornerRadius="0" Padding="-10,-10,0,0" Style="{StaticResource PathTabViewStyle}" TabWidthMode="SizeToContent" IsAddButtonVisible="False" CanCloseTabs="False" VerticalAlignment="Stretch">
788+
<Grid Padding="4,1,1,1" HorizontalAlignment="Stretch" BorderBrush="DarkGray" Windows10version1809:CornerRadius="2" BorderThickness="1" x:Name="ClickablePath" VerticalAlignment="Stretch">
789+
<uilib:TabView HorizontalContentAlignment="Stretch" x:Name="PathViewInteract" SelectionChanged="ClickablePathView_SelectionChanged" VerticalContentAlignment="Stretch" CanDragDropTabs="False" CornerRadius="0" Padding="-10,-10,0,0" Style="{StaticResource PathTabViewStyle}" TabWidthMode="SizeToContent" IsAddButtonVisible="False" CanCloseTabs="False" VerticalAlignment="Stretch">
790790
<uilib:TabView.Resources>
791791
<!--<x:Double x:Key="TabViewItemHeaderPadding">0</x:Double>-->
792792
<CornerRadius x:Key="TabViewItemCornerRadius">0</CornerRadius>

Files UWP/ProHome.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Files.Interacts;
44
using Files.Navigation;
55
using Microsoft.UI.Xaml.Controls;
6+
using Microsoft.UI.Xaml.Controls.Primitives;
67
using System;
78
using System.Collections.Generic;
89
using System.Collections.ObjectModel;

Files UWP/YourHome.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,15 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
9999
};
100100
string componentLabel = "Favorites";
101101
string tag = "Favorites";
102-
GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Add(new Microsoft.UI.Xaml.Controls.TabViewItem()
102+
Microsoft.UI.Xaml.Controls.TabViewItem item = new Microsoft.UI.Xaml.Controls.TabViewItem()
103103
{
104104
Header = componentLabel + " >",
105105
Tag = tag,
106106
CornerRadius = new CornerRadius(0),
107107
Style = tabStyleFixed,
108108
FontWeight = weight
109-
});
109+
};
110+
GetCurrentSelectedTabInstance<ProHome>().accessiblePathTabView.Items.Add(item);
110111

111112
}
112113

0 commit comments

Comments
 (0)