I dragged two Details (Gridview) from the Data Sources window unto my form and want them to display different rows from the same table.
I can't seem to be able to achieve this because any change I make to one reflects on the other one.
<Window x:Class="MyApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MyApp" Height="579" Width="727" xmlns:my="clr-namespace:MyApp" Loaded="Window_Loaded">
<Window.Resources>
<my:MyAppDataSet x:Key="myAppDataSet" />
<CollectionViewSource x:Key="membersViewSource" Source="{Binding Path=Members, Source={StaticResource myAppDataSet}}" />
</Window.Resources>
<Grid>
<Grid DataContext="{StaticResource membersViewSource}" HorizontalAlignment="Left" Margin="19,60,0,0" Name="grid1" VerticalAlignment="Top" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="ID:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Grid.Row="0" Height="23" HorizontalAlignment="Left" Margin="3" Name="iDTextBox" Text="{Binding Path=ID, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
<Label Content="First Name:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
<Label Content="{Binding Path=First Name}" Grid.Column="1" Grid.Row="1" Height="28" HorizontalAlignment="Left" Margin="3" Name="first_NameLabel" VerticalAlignment="Center" />
</Grid>
<Grid DataContext="{StaticResource membersViewSource}" Grid.Column="1" HorizontalAlignment="Left" Margin="366,55,0,0" Name="grid2" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Content="ID:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Grid.Row="0" Height="23" HorizontalAlignment="Left" Margin="3" Name="iDTextBox1" Text="{Binding Path=ID, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
<Label Content="First Name:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
<Label Content="{Binding Path=First Name}" Grid.Column="1" Grid.Row="1" Height="28" HorizontalAlignment="Left" Margin="3" Name="first_NameLabel1" VerticalAlignment="Center" />
</Grid>
</Grid>
</Window>
private void Window_Loaded(object sender, RoutedEventArgs e)
{
MyApp.MyAppDataSet MyAppDataSet = ((MyApp.MyappDataSet)(this.FindResource("MyAppDataSet")));
MyApp.MyAppDataSetTableAdapters.MembersTableAdapter myAppSetMembersTableAdapter = new MyApp.MyAppTableAdapters.MembersTableAdapter();
myAppMembersTableAdapter.Fill(myAppataSet.Members);
System.Windows.Data.CollectionViewSource membersViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("membersViewSource")));
membersViewSource.View.MoveCurrentToFirst();
}