Added the NewControl as a content replacement for the MainWindow.
This commit is contained in:
1 parent
8c7e1b917f
commit
0e5be04b02
31 files changed
+262
-153
No files matched your search
@@ -55,11 +55,14 @@
|
||||
</DockPanel>
|
||||
<DockPanel DockPanel.Dock="Bottom">
|
||||
<Grid HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" ColumnDefinitions="Auto, Auto, Auto, Auto" DockPanel.Dock="Left">
|
||||
<Button Grid.Column="0" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="New..." />
|
||||
<Button Grid.Column="1" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Edit..." />
|
||||
<Button Grid.Column="2" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Delete" />
|
||||
<Button Grid.Column="3" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Find..."
|
||||
<Button Grid.Column="0" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="New..."
|
||||
Command="{Binding $parent[Window].((viewModels:MainWindowViewModel)DataContext).AddItem}"/>
|
||||
<Button Grid.Column="1" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Edit..."
|
||||
Command="{Binding $parent[Window].((viewModels:MainWindowViewModel)DataContext).EditItem}"/>
|
||||
<Button Grid.Column="2" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Delete"
|
||||
Command="{Binding $parent[Window].((viewModels:MainWindowViewModel)DataContext).DeleteItem}"/>
|
||||
<Button Grid.Column="3" Margin="5" Width="100" HorizontalContentAlignment="Center" Content="Find..."
|
||||
Command="{Binding $parent[Window].((viewModels:MainWindowViewModel)DataContext).FindItem}"/>
|
||||
</Grid>
|
||||
<Grid HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" ColumnDefinitions="Auto, Auto" DockPanel.Dock="Right">
|
||||
<Label Grid.Column="0" Margin="5" VerticalAlignment="Center" Content="{Binding TotalValue, StringFormat='Total Value: ${0:0.00}'}" />
|
||||
|
||||
@@ -5,5 +5,11 @@
|
||||
xmlns:viewModels="clr-namespace:PcgsInvUi.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="PcgsInvUi.Views.MainWindow" x:DataType="viewModels:MainWindowViewModel"
|
||||
Title="MainWindow"
|
||||
Content="{Binding Content}" />
|
||||
Title="MainWindow">
|
||||
<SplitView Name="Sidebar">
|
||||
<SplitView.Pane>
|
||||
<UserControl Content="{Binding SidebarContent}"/>
|
||||
</SplitView.Pane>
|
||||
<UserControl Content="{Binding MainContent}"/>
|
||||
</SplitView>
|
||||
</Window>
|
||||
@@ -1,24 +0,0 @@
|
||||
<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:viewmodels="clr-namespace:PcgsInvUi.ViewModels"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="PcgsInvUi.Views.NewControl" x:DataType="viewmodels:NewViewModel">
|
||||
<DockPanel>
|
||||
<Grid DockPanel.Dock="Top" ColumnDefinitions="Auto, *" RowDefinitions="*, *, *">
|
||||
<Label Grid.Column="0" Grid.Row="0" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="PCGS #:"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Margin="5, 5, 10, 5" />
|
||||
<Label Grid.Column="0" Grid.Row="1" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="Grade:"/>
|
||||
<ComboBox Name="GradeChoices" Grid.Column="1" Grid.Row="1" SelectedIndex="0" Margin="5, 5, 10, 5" />
|
||||
<Label Grid.Column="0" Grid.Row="2" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="Quantity:"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Margin="5, 5, 10, 5" />
|
||||
</Grid>
|
||||
<Grid DockPanel.Dock="Bottom" ColumnDefinitions="*, *">
|
||||
<Button Grid.Column="0" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Width="90" HorizontalContentAlignment="Center" Content="OK" Command="{Binding OkCommand}" />
|
||||
<Button Grid.Column="1" Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Width="90" HorizontalContentAlignment="Center" Content="Cancel" Command="{Binding CancelCommand}"/>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
@@ -1,64 +0,0 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
namespace PcgsInvUi.Views;
|
||||
|
||||
public partial class NewControl : UserControl
|
||||
{
|
||||
public string SelectedGrade { get; set; } = "";
|
||||
|
||||
public void AcceptClick(object source, RoutedEventArgs args)
|
||||
{
|
||||
// TODO Send a message to the MainWindow to add a new coin and close the NewControl.
|
||||
}
|
||||
|
||||
public void CancelClick(object source, RoutedEventArgs args)
|
||||
{
|
||||
// TODO Send a message to the MainWindow to close the NewControl.
|
||||
}
|
||||
|
||||
public NewControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
GradeChoices.SelectedItem = SelectedGrade;
|
||||
// Had to type this out - there's no pattern to follow.
|
||||
GradeChoices.ItemsSource = new ObservableCollection<string>()
|
||||
{
|
||||
"PO01",
|
||||
"FR02",
|
||||
"AG03",
|
||||
"G04",
|
||||
"G06",
|
||||
"VG08",
|
||||
"VG10",
|
||||
"F12",
|
||||
"F15",
|
||||
"VF20",
|
||||
"VF25",
|
||||
"VF30",
|
||||
"VF35",
|
||||
"EF40",
|
||||
"EF45",
|
||||
"AU50",
|
||||
"AU53",
|
||||
"AU55",
|
||||
"AU58",
|
||||
"MS60",
|
||||
"MS61",
|
||||
"MS62",
|
||||
"MS63",
|
||||
"MS64",
|
||||
"MS65",
|
||||
"MS66",
|
||||
"MS67",
|
||||
"MS68",
|
||||
"MS69",
|
||||
"MS70"
|
||||
};
|
||||
}
|
||||
|
||||
public NewControl(object? context = null) : this()
|
||||
{
|
||||
DataContext = context;
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
<TextBox Grid.Column="1" Grid.Row="0" Margin="5, 5, 10, 5" Text="{Binding PcgsNumber}"/>
|
||||
<Label Grid.Column="0" Grid.Row="1" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="Grade:"/>
|
||||
<ComboBox Name="GradeChoices" Grid.Column="1" Grid.Row="1" SelectedIndex="0" Margin="5, 5, 10, 5"
|
||||
SelectedItem="{Binding Grade}"/>
|
||||
ItemsSource="{Binding GradesList}" SelectedItem="{Binding Grade}"/>
|
||||
<Label Grid.Column="0" Grid.Row="2" Margin="5, 5, 20, 5" VerticalAlignment="Center" Content="Quantity:"/>
|
||||
<TextBox Grid.Column="1" Grid.Row="2" Margin="5, 5, 10, 5" Text="{Binding Quantity}"/>
|
||||
</Grid>
|
||||
|
||||
Reference in new issue
Block a user