Skip to content

Commit 6b6b0fa

Browse files
committed
fix possible content frame navigation issue
1 parent 7e9ed8e commit 6b6b0fa

File tree

4 files changed

+38
-11
lines changed

4 files changed

+38
-11
lines changed

Flow.Launcher/SettingWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@
171171
IsPaneToggleButtonVisible="False"
172172
IsSettingsVisible="False"
173173
IsTabStop="False"
174+
Loaded="NavView_Loaded"
174175
OpenPaneLength="240"
175176
PaneDisplayMode="Left"
176177
SelectionChanged="NavigationView_SelectionChanged">

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel)
2929
_api = api;
3030
InitializePosition();
3131
InitializeComponent();
32-
NavView.SelectedItem = NavView.MenuItems[0]; /* Set First Page */
3332
}
3433

3534
private void OnLoaded(object sender, RoutedEventArgs e)
@@ -169,7 +168,11 @@ private void NavigationView_SelectionChanged(NavigationView sender, NavigationVi
169168
else
170169
{
171170
var selectedItem = (NavigationViewItem)args.SelectedItem;
172-
if (selectedItem == null) return;
171+
if (selectedItem == null)
172+
{
173+
NavView_Loaded(sender, null); /* Reset First Page */
174+
return;
175+
}
173176

174177
var pageType = selectedItem.Name switch
175178
{
@@ -186,5 +189,22 @@ private void NavigationView_SelectionChanged(NavigationView sender, NavigationVi
186189
}
187190
}
188191

192+
private void NavView_Loaded(object sender, RoutedEventArgs e)
193+
{
194+
if (ContentFrame.IsLoaded)
195+
{
196+
ContentFrame_Loaded(sender, e);
197+
}
198+
else
199+
{
200+
ContentFrame.Loaded += ContentFrame_Loaded;
201+
}
202+
}
203+
204+
private void ContentFrame_Loaded(object sender, RoutedEventArgs e)
205+
{
206+
NavView.SelectedItem ??= NavView.MenuItems[0]; /* Set First Page */
207+
}
208+
189209
public record PaneData(Settings Settings, Updater Updater, IPortable Portable);
190210
}

Flow.Launcher/WelcomeWindow.xaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
Grid.Column="0"
4444
Width="16"
4545
Height="16"
46-
Margin="10,4,4,4"
46+
Margin="10 4 4 4"
4747
RenderOptions.BitmapScalingMode="HighQuality"
4848
Source="/Images/app.png" />
4949
<TextBlock
5050
Grid.Column="1"
51-
Margin="4,0,0,0"
51+
Margin="4 0 0 0"
5252
VerticalAlignment="Center"
5353
FontSize="12"
5454
Foreground="{DynamicResource Color05B}"
@@ -82,6 +82,7 @@
8282
<ui:Frame
8383
x:Name="ContentFrame"
8484
HorizontalAlignment="Stretch"
85+
Loaded="ContentFrame_Loaded"
8586
ScrollViewer.CanContentScroll="True"
8687
ScrollViewer.HorizontalScrollBarVisibility="Visible"
8788
ScrollViewer.VerticalScrollBarVisibility="Visible">
@@ -97,7 +98,7 @@
9798
Grid.Row="1"
9899
Background="{DynamicResource Color00B}"
99100
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
100-
BorderThickness="0,1,0,0">
101+
BorderThickness="0 1 0 0">
101102
<Grid>
102103
<Grid.ColumnDefinitions>
103104
<ColumnDefinition Width="130" />
@@ -111,7 +112,7 @@
111112
VerticalAlignment="Center">
112113
<TextBlock
113114
Name="PageNavigation"
114-
Margin="0,2,0,0"
115+
Margin="0 2 0 0"
115116
HorizontalAlignment="Center"
116117
VerticalAlignment="Center"
117118
FontSize="14"
@@ -124,20 +125,20 @@
124125
Grid.Column="0"
125126
Width="100"
126127
Height="40"
127-
Margin="20,5,0,5"
128+
Margin="20 5 0 5"
128129
Click="BtnCancel_OnClick"
129130
Content="{DynamicResource Skip}"
130131
DockPanel.Dock="Right"
131132
FontSize="14" />
132133
<DockPanel
133134
Grid.Column="2"
134-
Margin="0,0,20,0"
135+
Margin="0 0 20 0"
135136
VerticalAlignment="Stretch">
136137
<Button
137138
x:Name="NextButton"
138139
Width="40"
139140
Height="40"
140-
Margin="8,5,0,5"
141+
Margin="8 5 0 5"
141142
Click="ForwardButton_Click"
142143
Content="&#xe76c;"
143144
DockPanel.Dock="Right"

Flow.Launcher/WelcomeWindow.xaml.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public WelcomeWindow(Settings settings)
1717
InitializeComponent();
1818
BackButton.IsEnabled = false;
1919
this.settings = settings;
20-
ContentFrame.Navigate(PageTypeSelector(1), settings);
2120
}
2221

2322
private NavigationTransitionInfo _transitionInfo = new SlideNavigationTransitionInfo()
@@ -102,9 +101,15 @@ private static Type PageTypeSelector(int pageNumber)
102101
var tRequest = new TraversalRequest(FocusNavigationDirection.Next);
103102
textBox.MoveFocus(tRequest);
104103
}
104+
105105
private void OnActivated(object sender, EventArgs e)
106106
{
107107
Keyboard.ClearFocus();
108108
}
109+
110+
private void ContentFrame_Loaded(object sender, RoutedEventArgs e)
111+
{
112+
ContentFrame.Navigate(PageTypeSelector(1), settings); /* Set First Page */
113+
}
109114
}
110-
}
115+
}

0 commit comments

Comments
 (0)