actually now its usable
This commit is contained in:
18
Kits/Views/DefinitionIdEditor.xaml
Normal file
18
Kits/Views/DefinitionIdEditor.xaml
Normal file
@@ -0,0 +1,18 @@
|
||||
<UserControl x:Class="Kits.Views.DefinitionIdEditor"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:kits="clr-namespace:Kits"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
|
||||
<UserControl.DataContext>
|
||||
<kits:DefinitionId/>
|
||||
</UserControl.DataContext>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBox Text="{Binding TypeId}" Margin="0,0,3,0" />
|
||||
<TextBlock Text="/" Margin="0,0,3,0" />
|
||||
<TextBox Text="{Binding SubtypeId}" Margin="0,0,3,0" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
12
Kits/Views/DefinitionIdEditor.xaml.cs
Normal file
12
Kits/Views/DefinitionIdEditor.xaml.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Kits.Views;
|
||||
|
||||
public partial class DefinitionIdEditor : UserControl
|
||||
{
|
||||
public DefinitionIdEditor()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
|
20
Kits/Views/EditButton.cs
Normal file
20
Kits/Views/EditButton.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
namespace Kits.Views;
|
||||
|
||||
public partial class EditButton : UserControl
|
||||
{
|
||||
public EditButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new ProperCollectionEditor
|
||||
{
|
||||
DataContext = DataContext,
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
Owner = Window.GetWindow(this)
|
||||
}.ShowDialog();
|
||||
}
|
||||
}
|
9
Kits/Views/EditButton.xaml
Normal file
9
Kits/Views/EditButton.xaml
Normal file
@@ -0,0 +1,9 @@
|
||||
<UserControl x:Class="Kits.Views.EditButton"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<Button Content="Edit" Click="ButtonBase_OnClick" />
|
||||
</UserControl>
|
21
Kits/Views/ProperCollectionEditor.cs
Normal file
21
Kits/Views/ProperCollectionEditor.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Windows;
|
||||
namespace Kits.Views;
|
||||
|
||||
public partial class ProperCollectionEditor : Window
|
||||
{
|
||||
public ProperCollectionEditor()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void ButtonAdd_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
((IList)DataContext).Add(Activator.CreateInstance(DataContext.GetType().GenericTypeArguments[0]));
|
||||
}
|
||||
private void ButtonDelete_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (ElementsGrid.SelectedItem is { } item)
|
||||
((IList)DataContext).Remove(item);
|
||||
}
|
||||
}
|
35
Kits/Views/ProperCollectionEditor.xaml
Normal file
35
Kits/Views/ProperCollectionEditor.xaml
Normal file
@@ -0,0 +1,35 @@
|
||||
<Window x:Class="Kits.Views.ProperCollectionEditor"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:views="clr-namespace:Torch.Views;assembly=Torch"
|
||||
mc:Ignorable="d"
|
||||
Title="Proper Collection Editor" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="2*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="10*" />
|
||||
<RowDefinition Height="1*" />
|
||||
</Grid.RowDefinitions>
|
||||
<DataGrid Margin="3" Name="ElementsGrid" AutoGenerateColumns="False" ItemsSource="{Binding }" IsReadOnly="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}" Width="*" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Margin="5" Content="Add" Click="ButtonAdd_OnClick" />
|
||||
<Button Grid.Column="1" Margin="5" Content="Delete" Click="ButtonDelete_OnClick" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<views:PropertyGrid Grid.Column="1" DataContext="{Binding ElementName=ElementsGrid, Path=SelectedItem, Mode=OneWay}" Margin="3" />
|
||||
</Grid>
|
||||
</Window>
|
Reference in New Issue
Block a user