Ionite
1 year ago
5 changed files with 152 additions and 0 deletions
@ -0,0 +1,84 @@
|
||||
<Page |
||||
Background="{DynamicResource ApplicationBackgroundBrush}" |
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}" |
||||
d:DataContext="{d:DesignInstance Type=viewModels:CheckpointManagerViewModel, |
||||
IsDesignTimeCreatable=True}" |
||||
d:DesignHeight="450" |
||||
d:DesignWidth="700" |
||||
mc:Ignorable="d" |
||||
x:Class="StabilityMatrix.CheckpointManagerPage" |
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
xmlns:models="clr-namespace:StabilityMatrix.Models" |
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" |
||||
xmlns:viewModels="clr-namespace:StabilityMatrix.ViewModels" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> |
||||
|
||||
<d:DesignProperties.DataContext> |
||||
<viewModels:CheckpointManagerViewModel> |
||||
<viewModels:CheckpointManagerViewModel.CheckpointFolderCards> |
||||
<models:CheckpointFolderCard Name="hi" /> |
||||
<models:CheckpointFolderCard Name="hi" /> |
||||
<models:CheckpointFolderCard Name="hi" /> |
||||
</viewModels:CheckpointManagerViewModel.CheckpointFolderCards> |
||||
</viewModels:CheckpointManagerViewModel> |
||||
</d:DesignProperties.DataContext> |
||||
|
||||
<Page.Resources> |
||||
<DataTemplate DataType="{x:Type models:CheckpointFolderCard}" x:Key="CheckpointFolderCardGridDataTemplate"> |
||||
<ui:CardExpander Header="{Binding Name}" IsExpanded="True"> |
||||
<ui:VirtualizingGridView> |
||||
<ItemsControl ItemsSource="{Binding CheckpointCards}"> |
||||
<ItemsControl.ItemTemplate> |
||||
<DataTemplate DataType="{x:Type models:CheckpointCard}"> |
||||
<ui:Card Margin="8"> |
||||
<VirtualizingStackPanel Orientation="Vertical"> |
||||
<ui:Image |
||||
CornerRadius="4" |
||||
Margin="4,4,4,8" |
||||
MinHeight="256" |
||||
MinWidth="200" |
||||
Source="{Binding Image}" |
||||
Stretch="UniformToFill" |
||||
Visibility="Collapsed" |
||||
Width="128" /> |
||||
<TextBlock |
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}" |
||||
Margin="0,0,0,0" |
||||
Text="{Binding Name}" |
||||
VerticalAlignment="Center" /> |
||||
<TextBlock |
||||
FontSize="11" |
||||
Foreground="{DynamicResource TextFillColorTertiaryBrush}" |
||||
Margin="0,2,0,0" |
||||
Text="{Binding FileName}" |
||||
VerticalAlignment="Center" /> |
||||
</VirtualizingStackPanel> |
||||
</ui:Card> |
||||
</DataTemplate> |
||||
</ItemsControl.ItemTemplate> |
||||
</ItemsControl> |
||||
</ui:VirtualizingGridView> |
||||
</ui:CardExpander> |
||||
</DataTemplate> |
||||
|
||||
<DataTemplate DataType="{x:Type models:CheckpointFolderCard}" x:Key="CheckpointFolderCardDataTemplate"> |
||||
<ContentControl Content="{Binding}"> |
||||
<ContentControl.Style> |
||||
<Style TargetType="{x:Type ContentControl}"> |
||||
<Setter Property="ContentTemplate" Value="{StaticResource CheckpointFolderCardGridDataTemplate}" /> |
||||
</Style> |
||||
</ContentControl.Style> |
||||
</ContentControl> |
||||
</DataTemplate> |
||||
</Page.Resources> |
||||
|
||||
<!-- Option Cards --> |
||||
<ItemsControl |
||||
HorizontalAlignment="Stretch" |
||||
HorizontalContentAlignment="Center" |
||||
ItemTemplate="{StaticResource CheckpointFolderCardDataTemplate}" |
||||
ItemsSource="{Binding CheckpointFolderCards}" |
||||
Margin="16,0,0,0" /> |
||||
</Page> |
@ -0,0 +1,13 @@
|
||||
using System.Windows.Controls; |
||||
using StabilityMatrix.ViewModels; |
||||
|
||||
namespace StabilityMatrix; |
||||
|
||||
public partial class CheckpointManagerPage : Page |
||||
{ |
||||
public CheckpointManagerPage(CheckpointManagerViewModel viewModel) |
||||
{ |
||||
InitializeComponent(); |
||||
DataContext = viewModel; |
||||
} |
||||
} |
@ -0,0 +1,16 @@
|
||||
using System.Windows.Media.Imaging; |
||||
using CommunityToolkit.Mvvm.ComponentModel; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
|
||||
public partial class CheckpointCard : ObservableObject |
||||
{ |
||||
[ObservableProperty] |
||||
private BitmapImage? image; |
||||
|
||||
[ObservableProperty] |
||||
private string name; |
||||
|
||||
[ObservableProperty] |
||||
private string fileName; |
||||
} |
@ -0,0 +1,19 @@
|
||||
using System.Collections.ObjectModel; |
||||
using CommunityToolkit.Mvvm.ComponentModel; |
||||
|
||||
namespace StabilityMatrix.Models; |
||||
|
||||
public partial class CheckpointFolderCard : ObservableObject |
||||
{ |
||||
[ObservableProperty] |
||||
private string name; |
||||
|
||||
public ObservableCollection<CheckpointCard> CheckpointCards { get; set; } = new() |
||||
{ |
||||
new CheckpointCard |
||||
{ |
||||
Name = "", |
||||
FileName = "", |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,20 @@
|
||||
using System.Collections.ObjectModel; |
||||
using CommunityToolkit.Mvvm.ComponentModel; |
||||
using StabilityMatrix.Models; |
||||
|
||||
namespace StabilityMatrix.ViewModels; |
||||
|
||||
public partial class CheckpointManagerViewModel : ObservableObject |
||||
{ |
||||
public ObservableCollection<CheckpointFolderCard> CheckpointFolderCards { get; set; } = new() |
||||
{ |
||||
new() |
||||
{ |
||||
Name = "Stable Diffusion" |
||||
}, |
||||
new() |
||||
{ |
||||
Name = "Lora" |
||||
} |
||||
}; |
||||
} |
Loading…
Reference in new issue