WPF Database Maintenance Window

EmployeesWindow.xaml Code

<lc:DbMaintenanceWindow x:Class="RingSoft.DbLookup.App.WPFCore.Northwind.EmployeesWindow"
  xmlns:lc="clr-namespace:RingSoft.DbLookup.Controls.WPF;assembly=RingSoft.DbLookup.Controls.WPF"
  xmlns:vmlib="clr-namespace:RingSoft.DbLookup.App.Library.Northwind.ViewModels;assembly=RingSoft.DbLookup.App.Library"
  xmlns:app="clr-namespace:RingSoft.DbLookup.App.WPFCore"
(...)>
    <Window.DataContext>
        <vmlib:EmployeeViewModel x:Name="EmployeeViewModel"/>
    </Window.DataContext>
  <DockPanel>
        <app:DbMaintenanceButtonsControl x:Name="ButtonsControl" DockPanel.Dock="Top"/>
        <lc:DbMaintenanceStatusBar x:Name="StatusBar" DockPanel.Dock="Bottom"/>
(...)
  </DockPanel>
</lc:DbMaintenanceWindow>

EmployeesWindow.xaml.cs Code

public partial class EmployeesWindow
{
    public override DbMaintenanceViewModelBase ViewModel => EmployeeViewModel;
    public override Control MaintenanceButtonsControl => ButtonsControl;
    public override DbMaintenanceStatusBar DbStatusBar => StatusBar;

    public EmployeesWindow()
    {
        InitializeComponent();
    }
}

Register Database Maintenance Window

LookupControlsGlobals.WindowRegistry.RegisterWindow<EmployeesWindow>(NorthwindLookupContext.Employees);

Database Window with Key Control

Create Database Maintenance Window containing a unique database string field.

LocationWindow.xaml Code

<lc:DbMaintenanceWindow x:Class="RingSoft.DbLookup.App.WPFCore.MegaDb.LocationWindow"
  xmlns:lc="clr-namespace:RingSoft.DbLookup.Controls.WPF;assembly=RingSoft.DbLookup.Controls.WPF"
  xmlns:vmlib="clr-namespace:RingSoft.DbLookup.App.Library.MegaDb.ViewModels;assembly=RingSoft.DbLookup.App.Library"
  xmlns:app="clr-namespace:RingSoft.DbLookup.App.WPFCore"
(...)>
    <Window.DataContext>
        <vmlib:LocationViewModel x:Name="LocationViewModel"/>
    </Window.DataContext>
   <DockPanel>
        <app:DbMaintenanceButtonsControl x:Name="ButtonsControl" DockPanel.Dock="Top"/>
        <lc:DbMaintenanceStatusBar x:Name="StatusBar" DockPanel.Dock="Bottom"/>
(...)
<Label Grid.Row="0" Grid.Column="2" Style="{StaticResource ControlLabel}" Content="Name"/> <lc:AutoFillControl x:Name="NameControl" Grid.Row="0" Grid.Column="3" Width="200" HorizontalAlignment="Left"/>
(...) </DockPanel>
</lc:DbMaintenanceWindow>

LocationWindow.xaml.cs Code

RegisterFormKeyControl binds  the NameControl AutoFillSetup dependency property to the base View Model’s KeyAutoFillSetup property and the NameControl’s AutoFillValue dependency property to the base View Model’s KeyAutoFillValue property.

    public partial class LocationWindow
    {
        public override DbMaintenanceViewModelBase ViewModel => LocationViewModel;
        public override Control MaintenanceButtonsControl => ButtonsControl;
        public override DbMaintenanceStatusBar DbStatusBar => StatusBar;

        public LocationWindow()
        {
            InitializeComponent();
            RegisterFormKeyControl(NameControl);
        }
    }