63 lines
3.2 KiB
XML
63 lines
3.2 KiB
XML
<Window xmlns="https://github.com/avaloniaui"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:vm="using:Photos.ViewModels"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:i="using:Avalonia.Xaml.Interactivity"
|
|
xmlns:ic="using:Avalonia.Xaml.Interactions.Core"
|
|
xmlns:models="using:Photos.Models"
|
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
|
x:Class="Photos.Views.MainWindow"
|
|
x:DataType="vm:MainWindowViewModel"
|
|
x:Name="Root"
|
|
Icon="/Assets/avalonia-logo.ico"
|
|
Title="Photos"
|
|
DragDrop.AllowDrop="True"
|
|
DragDrop.Drop="DropHandler"
|
|
>
|
|
|
|
<Design.DataContext>
|
|
<!-- This only sets the DataContext for the previewer in an IDE,
|
|
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
|
|
<vm:MainWindowViewModel/>
|
|
</Design.DataContext>
|
|
|
|
<Grid ColumnDefinitions="1*, 5*" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
|
<Menu>
|
|
<Button Content="Open Directory" Command="{Binding OpenDirectory}"/>
|
|
</Menu>
|
|
<ScrollViewer Grid.Column="1">
|
|
<ItemsControl ItemsSource="{Binding Photos}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
|
<ItemsControl.ItemsPanel>
|
|
<ItemsPanelTemplate>
|
|
<WrapPanel ScrollViewer.VerticalScrollBarVisibility="Auto"/>
|
|
</ItemsPanelTemplate>
|
|
</ItemsControl.ItemsPanel>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate DataType="models:Photo">
|
|
<StackPanel Orientation="Vertical" Margin="20">
|
|
<i:Interaction.Behaviors>
|
|
<ic:EventTriggerBehavior EventName="PointerReleased">
|
|
<ic:InvokeCommandAction Command="{Binding DataContext.PhotoClicked, ElementName=Root}" PassEventArgsToCommand="True"/>
|
|
</ic:EventTriggerBehavior>
|
|
</i:Interaction.Behaviors>
|
|
<Image Source="{Binding Source}" Width="150" Height="150"/>
|
|
<TextBlock Text="{Binding DisplayName}" HorizontalAlignment="Center" Width="150"/>
|
|
<TextBlock Text="{Binding DisplayPath}" HorizontalAlignment="Center" Width="150"/>
|
|
</StackPanel>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</ScrollViewer>
|
|
<Grid Grid.Column="0" Grid.ColumnSpan="2" IsEnabled="{Binding SelectedPhoto}">
|
|
<Image Source="{Binding SelectedPhoto.Source}" Margin="50">
|
|
<i:Interaction.Behaviors>
|
|
<ic:EventTriggerBehavior EventName="PointerReleased">
|
|
<ic:InvokeCommandAction Command="{Binding Path=SelectedPhotoClicked}"/>
|
|
</ic:EventTriggerBehavior>
|
|
</i:Interaction.Behaviors>
|
|
</Image>
|
|
</Grid>
|
|
</Grid>
|
|
</Window>
|