Skip to content

Commit 32b6c49

Browse files
committed
Scroll into view added
1 parent 17b52f8 commit 32b6c49

4 files changed

Lines changed: 17 additions & 8 deletions

File tree

Source/NETworkManager/MainWindow.xaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@
314314
</Grid>
315315
</Border>
316316
<ScrollViewer Grid.Row="1" ManipulationBoundaryFeedback="ScrollViewer_ManipulationBoundaryFeedback" Style="{StaticResource FadeOutScrollViewer}">
317-
<ListView ItemsSource="{Binding Applications}" SelectedItem="{Binding SelectedApplication, Mode=TwoWay}" SelectionMode="Single" BorderThickness="0">
317+
<ListView x:Name="listViewApplication" ItemsSource="{Binding Applications}" SelectedItem="{Binding SelectedApplication, Mode=TwoWay}" SelectionMode="Single" BorderThickness="0">
318318
<ListView.ItemTemplate>
319319
<DataTemplate>
320320
<Grid Height="48">
@@ -433,10 +433,8 @@
433433
</ListView.ItemContainerStyle>
434434
<!-- BUGFIX This has to be set, to enable mouse wheel scrolling -->
435435
<ListBox.Template>
436-
<ControlTemplate TargetType="ItemsControl">
437-
<Border>
438-
<ItemsPresenter />
439-
</Border>
436+
<ControlTemplate>
437+
<ItemsPresenter />
440438
</ControlTemplate>
441439
</ListBox.Template>
442440
<ListBox.ItemsPanel>

Source/NETworkManager/MainWindow.xaml.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,11 @@ private void LoadApplicationList()
279279
return (regex.Replace(info.TranslatedName, "").IndexOf(search, StringComparison.OrdinalIgnoreCase) > -1) || (regex.Replace(info.Name.ToString(), "").IndexOf(search, StringComparison.OrdinalIgnoreCase) >= 0);
280280
};
281281

282+
// Get application from settings
282283
SelectedApplication = Applications.SourceCollection.Cast<ApplicationViewInfo>().FirstOrDefault(x => x.Name == SettingsManager.Current.Application_DefaultApplicationViewName);
284+
285+
// Scroll into view
286+
listViewApplication.ScrollIntoView(SelectedApplication);
283287
}
284288

285289
private async void MetroWindowMain_Closing(object sender, CancelEventArgs e)
@@ -451,6 +455,9 @@ private void ClearSearchFilterOnApplicationListMinimize()
451455
return;
452456

453457
Search = string.Empty;
458+
459+
// Scroll into view
460+
listViewApplication.ScrollIntoView(SelectedApplication);
454461
}
455462
#endregion
456463

Source/NETworkManager/Views/Settings/SettingsView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</Grid.ColumnDefinitions>
1616
<Border Grid.Column="0" BorderBrush="{DynamicResource GrayBrush8}" BorderThickness="0,0,1,0">
1717
<ScrollViewer ManipulationBoundaryFeedback="ScrollViewer_ManipulationBoundaryFeedback" Style="{StaticResource FadeOutScrollViewer}">
18-
<ListBox ItemsSource="{Binding SettingsViews}" SelectedItem="{Binding SelectedSettingsView}" Margin="10">
18+
<ListBox x:Name="listBoxSettings" ItemsSource="{Binding SettingsViews}" SelectedItem="{Binding SelectedSettingsView}" Margin="10">
1919
<ListBox.GroupStyle>
2020
<GroupStyle>
2121
<GroupStyle.ContainerStyle>

Source/NETworkManager/Views/Settings/SettingsView.xaml.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ public ApplicationViewManager.Name SelectedApplicationName
1414
get { return _selectedApplicationName; }
1515
set
1616
{
17-
viewModel.SelectedApplicationName = value;
18-
1917
if (value == _selectedApplicationName)
2018
return;
19+
20+
// Set the view based on the name (in viewmodel)
21+
viewModel.SelectedApplicationName = value;
22+
23+
// Scroll into view
24+
listBoxSettings.ScrollIntoView(viewModel.SelectedSettingsView);
2125

2226
_selectedApplicationName = value;
2327
}

0 commit comments

Comments
 (0)