Skip to content

Commit

Permalink
Add ProductView2 with markup from TemplateStudio
Browse files Browse the repository at this point in the history
  • Loading branch information
LeftTwixWand committed Jan 21, 2024
1 parent d4ee1ec commit eadcd92
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Inventory.Infrastructure.Services.Navigation;

internal sealed class PageService : IPageService
{
private readonly Dictionary<string, Type> _pages = new();
private readonly Dictionary<string, Type> _pages = [];

public PageService()
{
Expand All @@ -30,7 +30,7 @@ public PageService()
Configure<ProductsViewModel, ProductsView>();
Configure<OrdersViewModel, OrdersView>();
Configure<ActivityLogViewModel, ActivityLogView>();
Configure<ProductViewModel, ProductView>();
Configure<ProductViewModel, ProductView2>();
}

public Type GetPageType(string key)
Expand Down
9 changes: 9 additions & 0 deletions src/Inventory.Presentation/Inventory.Presentation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<None Remove="Views\Orders\OrdersView.xaml" />
<None Remove="Views\Products\ProductsView.xaml" />
<None Remove="Views\Product\ProductView.xaml" />
<None Remove="Views\Product\ProductView2.xaml" />
<None Remove="Views\SettingsPage.xaml" />
<None Remove="Views\Shell\ShellView.xaml" />
<None Remove="Windows\MainWindow.xaml" />
Expand Down Expand Up @@ -98,4 +99,12 @@
<ItemGroup>
<Folder Include="Views\Settings\" />
</ItemGroup>

<ItemGroup>
<CustomAdditionalCompileInputs Remove="Views\Product\ProductView2.xaml" />
</ItemGroup>

<ItemGroup>
<Resource Remove="Views\Product\ProductView2.xaml" />
</ItemGroup>
</Project>
106 changes: 106 additions & 0 deletions src/Inventory.Presentation/Views/Product/ProductView2.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<Page
x:Class="Inventory.Presentation.Views.Product.ProductView2"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Inventory.Presentation.Views.Product"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid x:Name="ContentArea">

<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState>
<VisualState.StateTriggers>
<!--641 is the default CompactModeThresholdWidth in NavigationView -->
<AdaptiveTrigger MinWindowWidth="641" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="propertiesGroup1.(RelativePanel.RightOf)" Value="itemHero" />
<Setter Target="propertiesGroup1.(RelativePanel.Below)" Value="title" />
<Setter Target="propertiesGroup2.(RelativePanel.RightOf)" Value="propertiesGroup1" />
<Setter Target="propertiesGroup2.(RelativePanel.Below)" Value="title" />
<Setter Target="propertiesGroup1.Width" Value="200" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>

<ScrollViewer
IsTabStop="True">
<StackPanel
x:Name="contentPanel">
<RelativePanel>
<Grid
x:Name="itemHero"
Width="200"
Height="200"
Margin="{StaticResource SmallRightMargin}"
Padding="{StaticResource XSmallLeftTopRightBottomMargin}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
RelativePanel.AlignTopWithPanel="True"
RelativePanel.AlignLeftWithPanel="True">
<FontIcon
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="70"
Glyph="{x:Bind ViewModel.Symbol}"
AutomationProperties.Name="{x:Bind ViewModel.SymbolName}" />
</Grid>

<TextBlock
x:Name="title"
Margin="{StaticResource XXSmallTopMargin}"
RelativePanel.AlignTopWithPanel="True"
RelativePanel.RightOf="itemHero"
Style="{ThemeResource TitleTextBlockStyle}"
Text="{x:Bind ViewModel.Company, Mode=OneWay}" />

<StackPanel x:Name="propertiesGroup1" RelativePanel.Below="itemHero">
<StackPanel x:Name="statusGroup" Margin="{StaticResource SmallTopMargin}">
<TextBlock Style="{ThemeResource SubtitleTextBlockStyle}" Text="Status" />
<TextBlock Style="{ThemeResource BodyTextBlockStyle}" Text="{x:Bind ViewModel.Status}" />
</StackPanel>

<StackPanel x:Name="orderDateGroup" Margin="{StaticResource SmallTopMargin}">
<TextBlock Style="{ThemeResource SubtitleTextBlockStyle}" Text="Order date" />
<TextBlock Style="{ThemeResource BodyTextBlockStyle}" Text="{x:Bind ViewModel.OrderDate}" />
</StackPanel>
</StackPanel>

<StackPanel x:Name="propertiesGroup2" RelativePanel.Below="propertiesGroup1">
<StackPanel x:Name="shipToGroup" Margin="{StaticResource SmallTopMargin}">
<TextBlock Style="{ThemeResource SubtitleTextBlockStyle}" Text="Ship to" />
<TextBlock Style="{ThemeResource BodyTextBlockStyle}" Text="{x:Bind ViewModel.ShipTo}" />
</StackPanel>

<StackPanel x:Name="orderTotalGroup" Margin="{StaticResource SmallTopMargin}">
<TextBlock Style="{ThemeResource SubtitleTextBlockStyle}" Text="Order total" />
<TextBlock Style="{ThemeResource BodyTextBlockStyle}" Text="{x:Bind ViewModel.OrderTotal}" />
</StackPanel>
</StackPanel>

</RelativePanel>

<TextBlock
Margin="{StaticResource SmallTopMargin}"
Style="{ThemeResource SubtitleTextBlockStyle}"
Text="Note 1" />
<TextBlock
Style="{ThemeResource BodyTextBlockStyle}"
Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis hendrerit nulla, vel molestie libero. In nec ultricies magna, ultricies molestie ipsum. Mauris non dignissim velit. Etiam malesuada blandit mauris eu maximus. Quisque ornare, felis nec scelerisque mollis, risus dolor posuere magna, in gravida quam mi id nisi. Nullam mattis consequat ex. Cras nulla neque, dictum ac urna et, vestibulum feugiat ex. Pellentesque malesuada accumsan ligula, vel fringilla lacus facilisis sit amet. Proin convallis tempor arcu, ac placerat libero pretium ut. Praesent hendrerit nisl at lobortis viverra. Fusce vitae velit odio. Nam ut tortor sed purus finibus sollicitudin quis at ante. Ut sodales dolor vel eros mollis suscipit. Donec eu nulla id urna ultricies consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" />

<TextBlock
Margin="{StaticResource SmallTopMargin}"
Style="{ThemeResource SubtitleTextBlockStyle}"
Text="Note 2" />
<TextBlock
Margin="{StaticResource MediumBottomMargin}"
Style="{ThemeResource BodyTextBlockStyle}"
Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis quis hendrerit nulla, vel molestie libero. In nec ultricies magna, ultricies molestie ipsum. Mauris non dignissim velit. Etiam malesuada blandit mauris eu maximus. Quisque ornare, felis nec scelerisque mollis, risus dolor posuere magna, in gravida quam mi id nisi. Nullam mattis consequat ex. Cras nulla neque, dictum ac urna et, vestibulum feugiat ex. Pellentesque malesuada accumsan ligula, vel fringilla lacus facilisis sit amet. Proin convallis tempor arcu, ac placerat libero pretium ut. Praesent hendrerit nisl at lobortis viverra. Fusce vitae velit odio. Nam ut tortor sed purus finibus sollicitudin quis at ante. Ut sodales dolor vel eros mollis suscipit. Donec eu nulla id urna ultricies consequat. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;" />
</StackPanel>
</ScrollViewer>
</Grid>
</Page>
71 changes: 71 additions & 0 deletions src/Inventory.Presentation/Views/Product/ProductView2.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using Inventory.Application.Models;
using Microsoft.UI.Xaml.Controls;

namespace Inventory.Presentation.Views.Product;

public sealed partial class ProductView2 : Page
{
public ProductView2()
{
InitializeComponent();
ViewModel = new SampleOrder()
{
OrderID = 10643, // Symbol Globe
OrderDate = new DateTime(1997, 8, 25),
RequiredDate = new DateTime(1997, 9, 22),
ShippedDate = new DateTime(1997, 9, 22),
ShipperName = "Speedy Express",
ShipperPhone = "(503) 555-9831",
Freight = 29.46,
Company = "Company A",
ShipTo = "Company A, Obere Str. 57, Berlin, 12209, Germany",
OrderTotal = 814.50,
Status = "Shipped",
SymbolCode = 57643,
SymbolName = "Globe",
Details = new List<SampleOrderDetail>()
{
new()
{
ProductID = 28,
ProductName = "Rössle Sauerkraut",
Quantity = 15,
Discount = 0.25,
QuantityPerUnit = "25 - 825 g cans",
UnitPrice = 45.60,
CategoryName = "Produce",
CategoryDescription = "Dried fruit and bean curd",
Total = 513.00,
},
new()
{
ProductID = 39,
ProductName = "Chartreuse verte",
Quantity = 21,
Discount = 0.25,
QuantityPerUnit = "750 cc per bottle",
UnitPrice = 18.0,
CategoryName = "Beverages",
CategoryDescription = "Soft drinks, coffees, teas, beers, and ales",
Total = 283.50,
},
new()
{
ProductID = 46,
ProductName = "Spegesild",
Quantity = 2,
Discount = 0.25,
QuantityPerUnit = "4 - 450 g glasses",
UnitPrice = 12.0,
CategoryName = "Seafood",
CategoryDescription = "Seaweed and fish",
Total = 18.00,
},
},
};
}

private SampleOrder ViewModel { get; }
}

0 comments on commit eadcd92

Please sign in to comment.