Skip to content

Commit

Permalink
AnnotationTab selected screenshot viewing
Browse files Browse the repository at this point in the history
  • Loading branch information
Neakita committed Oct 14, 2024
1 parent adc204d commit 007d1a2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 25 deletions.
53 changes: 30 additions & 23 deletions SightKeeper.Avalonia/Annotation/AnnotationTab.axaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
<UserControl xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SightKeeper.Avalonia.Annotation"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SightKeeper.Avalonia.Annotation.AnnotationTab"
x:DataType="local:AnnotationTabViewModel">
<Border Classes="regular-padding">
<Grid ColumnDefinitions="* 4* Auto">
<local:Screenshots
Grid.Column="0"
DataContext="{Binding Screenshots}"/>
<Border Grid.Column="2" Classes="outer wide-padding" VerticalAlignment="Top">
<StackPanel Classes="regular-spacing">
<ComboBox SelectedItem="{Binding SelectedDataSet}"
ItemsSource="{Binding DataSets}"
DisplayMemberBinding="{Binding Name}"
PlaceholderText="Select data set"/>
<local:ScreenshottingSettings DataContext="{Binding ScreenshottingSettings}"/>
</StackPanel>
</Border>
</Grid>
</Border>
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SightKeeper.Avalonia.Annotation"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SightKeeper.Avalonia.Annotation.AnnotationTab"
x:DataType="local:AnnotationTabViewModel">
<Border Classes="regular-padding">
<Grid ColumnDefinitions="* 4* Auto">
<local:Screenshots
Grid.Column="0"
DataContext="{Binding Screenshots}"/>
<Image
Grid.Column="1"
Source="{Binding Screenshots.SelectedScreenshot.Image}"/>
<Border
Grid.Column="2"
Classes="outer wide-padding"
VerticalAlignment="Top">
<StackPanel Classes="regular-spacing">
<ComboBox
SelectedItem="{Binding SelectedDataSet}"
ItemsSource="{Binding DataSets}"
DisplayMemberBinding="{Binding Name}"
PlaceholderText="Select data set"/>
<local:ScreenshottingSettings DataContext="{Binding ScreenshottingSettings}"/>
</StackPanel>
</Border>
</Grid>
</Border>
</UserControl>
4 changes: 3 additions & 1 deletion SightKeeper.Avalonia/Annotation/Screenshots.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SightKeeper.Avalonia.Annotation.Screenshots"
x:DataType="local:ScreenshotsViewModel">
<ListBox ItemsSource="{Binding DisplayScreenshots}">
<ListBox
ItemsSource="{Binding DisplayScreenshots}"
SelectedItem="{Binding SelectedScreenshot}">
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source="{Binding Image}"/>
Expand Down
4 changes: 3 additions & 1 deletion SightKeeper.Avalonia/Annotation/ScreenshotsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
using System.Reactive.Disposables;
using System.Reactive.Linq;
using CommunityToolkit.Diagnostics;
using CommunityToolkit.Mvvm.ComponentModel;
using DynamicData;
using SightKeeper.Application;
using SightKeeper.Application.Extensions;
using SightKeeper.Domain.Model.DataSets.Screenshots;

namespace SightKeeper.Avalonia.Annotation;

internal sealed class ScreenshotsViewModel : ViewModel
internal sealed partial class ScreenshotsViewModel : ViewModel
{
public ScreenshotsLibrary? Library
{
Expand Down Expand Up @@ -58,4 +59,5 @@ public ScreenshotsViewModel(ObservableDataAccess<Screenshot> observableDataAcces
private readonly CompositeDisposable _disposable = new();
private readonly SourceList<Screenshot> _screenshotsSource = new();
private ScreenshotsLibrary? _library;
[ObservableProperty] private ScreenshotViewModel? _selectedScreenshot;
}

0 comments on commit 007d1a2

Please sign in to comment.