Witam,
Na wstępie chciałbym poinformować że jestem kompletnie zielony w w/w technologiach.
Zrobiłem już pseudo program wyświetlający klientów z bazy danych northwind na bazie tutoriala znalezionego w sieci.

Nie mam pojęcia natomiast jak w nowym oknie zbudować formularz dodający, modyfikujący i usuwający klienta z bazy po wciśnięciu edytuj.
Wiem że porywam sie na gleboka wode ale tak najszybciej sie naucze i jest mi to bardzo potrzebne.
Wklejam trochę kodu:
<Window x:Class="NorthwindApp.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Northwind Application" Height="480" Width="600">
<Window.Resources>
<Style TargetType="{x:Type Ellipse}" x:Key="CustomerCircle">
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Fill">
<Setter.Value>
<LinearGradientBrush EndPoint="-0.116,-0.03" StartPoint="1.298,1.03">
<GradientStop Color="black" Offset="0"/>
<GradientStop Color="yellow" Offset="1"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
<DataTemplate x:Key="ShowCustomer">
<StackPanel Orientation="Horizontal">
<Ellipse Style="{StaticResource CustomerCircle}" Width="40" Height="40" Margin="10 10 0 10"/>
<StackPanel Margin="10">
<TextBlock Text="{Binding ContactName}" FontWeight="Bold"/>
<TextBlock Text="{Binding ContactTitle}" FontStyle="Italic"/>
<TextBlock Text="{Binding ContactName}" FontSize="10"/>
<TextBlock Text="{Binding Country}" />
<TextBlock Text="{Binding CompanyName}"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</Window.Resources>
<ScrollViewer>
<DockPanel>
<ListView DockPanel.Dock="Bottom" x:Name="TheListView"
ItemTemplate="{StaticResource ShowCustomer}">
<ListView.Background>
<RadialGradientBrush>
<GradientStop Color="#FFF9F3F3" Offset="0"/>
<GradientStop Color="#FFD3CFCF" Offset="1"/>
</RadialGradientBrush>
</ListView.Background>
</ListView>
<Menu x:Name="TheMenu" DockPanel.Dock="Top" Background="gray">
<MenuItem Header="Opcje" Background="Black" FontSize="15" Foreground="White">
<MenuItem x:Name="MenuItemPoland" Header="Pokaz klientow" Click="MenuItem_ShowPoland"/>
<MenuItem x:Name="MenuItemEdycja" Header="Edytuj" Click="MenuItem_Edycja"/>
<MenuItem>
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<TextBox x:Name="TextBoxSearch" Width="200" Margin="2"/>
<Button Content="Wyszukaj"
Click="ButtonSearch_Click"
Margin="2"/>
</StackPanel>
</MenuItem.Header>
</MenuItem>
</MenuItem>
</Menu>
</DockPanel>
</ScrollViewer>
</Window>
i środek:
USING System.Linq;
USING System.Windows;
USING NorthwindApp.Model;
USING System.Windows.Controls;
USING System.Collections.Generic;
namespace NorthwindApp
{
public partial class Window1 : Window
{
private NorthwindDataContext _db = new NorthwindDataContext();
private IEnumerable<Customer> _customers = NULL;
public Window1()
{
InitializeComponent();
//DEFAULT
MenuItemPoland.RaiseEvent(new RoutedEventArgs(MenuItem.ClickEvent));
}
void MenuItem_Edycja(object sender, RoutedEventArgs e)
{
Edycja window = new Edycja();
window.SHOW();
}
private void MenuItem_ShowPoland(object sender, RoutedEventArgs e)
{
_customers = FROM c IN _db.Customers
WHERE c.Country == "Poland"
SELECT c;
TheListView.ItemsSource = _customers;
}
private void ButtonSearch_Click(object sender, RoutedEventArgs e)
{
string searchText = TextBoxSearch.Text.ToUpper();
_customers = FROM c IN _db.Customers
WHERE c.ContactName.ToUpper().Contains(searchText) ||
c.ContactTitle.ToUpper().Contains(searchText) ||
c.CompanyName.ToUpper().Contains(searchText)
SELECT c;
TheListView.ItemsSource = _customers;
//makes the menu disappear appropriately after button IS clicked
TheMenu.Focus();
TheListView.Focus();
}
}
}
Tutorial według którego zrobiłemProszę o jakąkolwiek pomoc i pozdrawiam.