Fixed section browser

This commit is contained in:
Ben Wallis 2017-12-07 21:36:42 +00:00
parent b88730fb3a
commit 523a9553d9
4 changed files with 18 additions and 9 deletions

View File

@ -268,6 +268,9 @@
<Compile Include="Views\StartPageView.xaml.cs"> <Compile Include="Views\StartPageView.xaml.cs">
<DependentUpon>StartPageView.xaml</DependentUpon> <DependentUpon>StartPageView.xaml</DependentUpon>
</Compile> </Compile>
<Compile Include="Views\ToolPanes\CommentBlockBrowserView.xaml.cs">
<DependentUpon>CommentBlockBrowserView.xaml</DependentUpon>
</Compile>
<Compile Include="Views\UpdateAvailableView.xaml.cs"> <Compile Include="Views\UpdateAvailableView.xaml.cs">
<DependentUpon>UpdateAvailableView.xaml</DependentUpon> <DependentUpon>UpdateAvailableView.xaml</DependentUpon>
</Compile> </Compile>

View File

@ -5,6 +5,12 @@ namespace Filtration.UserControls
{ {
public class AutoScrollingListBox : ListBox public class AutoScrollingListBox : ListBox
{ {
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
{
ScrollIntoView(e.AddedItems[0]);
base.OnSelectionChanged(e);
}
protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e) protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
{ {
if (e.NewItems == null) return; if (e.NewItems == null) return;

View File

@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:converters="clr-namespace:Filtration.Converters" xmlns:converters="clr-namespace:Filtration.Converters"
xmlns:toolPanes="clr-namespace:Filtration.ViewModels.ToolPanes" xmlns:toolPanes="clr-namespace:Filtration.ViewModels.ToolPanes"
xmlns:viewModels="clr-namespace:Filtration.ViewModels"
d:DataContext="{d:DesignInstance Type=toolPanes:CommentBlockBrowserViewModel}" d:DataContext="{d:DesignInstance Type=toolPanes:CommentBlockBrowserViewModel}"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"> d:DesignHeight="300" d:DesignWidth="300">
@ -14,13 +15,12 @@
<Grid> <Grid>
<ListBox ItemsSource="{Binding ItemFilterCommentBlockViewModels}" <ListBox ItemsSource="{Binding ItemFilterCommentBlockViewModels}"
SelectedItem="{Binding SelectedItemFilterCommentBlockViewModel}" SelectedItem="{Binding SelectedItemFilterCommentBlockViewModel}"
x:Name="SectionBrowserListBox"
ScrollViewer.HorizontalScrollBarVisibility="Hidden"><!--SelectionChanged="SectionBrowserListBox_OnSelectionChanged"--> ScrollViewer.HorizontalScrollBarVisibility="Hidden"><!--SelectionChanged="SectionBrowserListBox_OnSelectionChanged"-->
<ListBox.Resources> <ListBox.Resources>
</ListBox.Resources> </ListBox.Resources>
<ListBox.ItemTemplate> <ListBox.ItemTemplate>
<DataTemplate> <DataTemplate DataType="viewModels:ItemFilterCommentBlockViewModel">
<TextBlock Text="{Binding Comment, Converter={StaticResource HashSignRemovalConverter}}" ToolTip="{Binding Comment}" /> <TextBlock Text="{Binding Comment, Converter={StaticResource HashSignRemovalConverter}}" ToolTip="{Binding Comment}" />
</DataTemplate> </DataTemplate>
</ListBox.ItemTemplate> </ListBox.ItemTemplate>