G
Gerhard
I have downloaded and installed both VS2010 RC and Silverlight 4 RC. In
testing out functionality, I built a simple RIA Business Application against
the Chinook database. I have a datagrid with the albums, another datagrid
with the tracks that ties to the selected album, and a combobox that ties to
the selected album's artist. When I do my first filter (using the built in
filter text box), all works fine, but if I change the filter, the combobox no
longer stays in sync (the datagrid does though). Can you please help? XAML
is as follows:
<navigationage
x:Class="Chinook.Home"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d" designWidth="640" designHeight="480"
Style="{StaticResource PageStyle}"
xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
xmlns:my="clr-namespace:Chinook.Web.Services"
xmlns:my1="clr-namespace:Chinook.Web.Models"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
DataContext="{Binding}">
<sdkage.Resources>
<CollectionViewSource x:Key="albumTracksViewSource" Source="{Binding
Path=Data.Tracks, ElementName=albumDomainDataSource1}" />
</sdkage.Resources>
<Grid x:Name="LayoutRoot">
<ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource
PageScrollViewerStyle}" Margin="-58,0,-58,-10">
<StackPanel x:Name="ContentStackPanel" Style="{StaticResource
ContentStackPanelStyle}">
<TextBlock x:Name="HeaderText" Style="{StaticResource
HeaderTextStyle}"
Text="{Binding
Path=ApplicationStrings.HomePageTitle, Source={StaticResource
ResourceWrapper}}"/>
<TextBlock x:Name="ContentText" Style="{StaticResource
ContentTextStyle}"
Text="Home page content"/>
<riaControlsomainDataSource
AutoLoad="True"
designData="{designInstance my1:Artist,
CreateList=true}"
Height="0" LoadedData="artistDomainDataSource_LoadedData"
Name="artistDomainDataSource"
QueryName="GetArtistsQuery"
Width="0">
<riaControlsomainDataSource.DomainContext>
<my:ChinookContext />
</riaControlsomainDataSource.DomainContext>
</riaControlsomainDataSource>
<ComboBox Height="27"
Name="comboBox1"
Width="398"
ItemsSource="{Binding}"
DataContext="{Binding
ElementName=artistDomainDataSource, Path=Data}"
DisplayMemberPath="Name"
SelectedValuePath="ArtistId"
SelectedValue="{Binding ElementName=albumDataGrid,
Path=SelectedItem.ArtistId, Mode=TwoWay}" />
<riaControlsomainDataSource
AutoLoad="False"
designData="{designInstance my1:Album,
CreateList=true}"
Height="0"
LoadedData="albumDomainDataSource_LoadedData"
Name="albumDomainDataSource"
QueryName="GetAlbumsByStartQuery"
Width="0">
<riaControlsomainDataSource.DomainContext>
<my:ChinookContext />
</riaControlsomainDataSource.DomainContext>
<riaControlsomainDataSource.QueryParameters>
<riaControlsarameter ParameterName="startString"
Value="{Binding ElementName=startStringTextBox, Path=Text}" />
</riaControlsomainDataSource.QueryParameters>
</riaControlsomainDataSource>
<StackPanel Height="30" Orientation="Horizontal">
<sdk:Label Content="Start String:" Margin="3"
VerticalAlignment="Center" />
<TextBox Name="startStringTextBox" Width="60" />
<Button Command="{Binding Path=LoadCommand,
ElementName=albumDomainDataSource}" Content="Load" Margin="3"
Name="albumDomainDataSourceLoadButton"
Click="albumDomainDataSourceLoadButton_Click" />
</StackPanel>
<sdkataGrid AutoGenerateColumns="False" Height="200"
ItemsSource="{Binding ElementName=albumDomainDataSource, Path=Data}"
Name="albumDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected"
Width="400">
<sdkataGrid.Columns>
<sdkataGridTextColumn x:Name="albumIdColumn"
Binding="{Binding Path=AlbumId}" Header="Album Id" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="artistIdColumn"
Binding="{Binding Path=ArtistId}" Header="Artist Id" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="titleColumn"
Binding="{Binding Path=Title}" Header="Title" Width="SizeToHeader" />
</sdkataGrid.Columns>
</sdkataGrid>
<riaControlsomainDataSource
AutoLoad="True"
designData="{designInstance my1:Track,
CreateList=true}"
Height="0"
LoadedData="trackDomainDataSource_LoadedData"
Name="trackDomainDataSource"
QueryName="GetTracksQuery"
Width="0">
<riaControlsomainDataSource.DomainContext>
<my:ChinookContext />
</riaControlsomainDataSource.DomainContext>
<riaControlsomainDataSource.FilterDescriptors>
<riaControls:FilterDescriptor
PropertyPath="AlbumId"
Operator="IsEqualTo"
IgnoredValue=""
Value="{Binding ElementName=albumDataGrid,
Path=SelectedItem.AlbumId, Mode=TwoWay}" >
</riaControls:FilterDescriptor>
</riaControlsomainDataSource.FilterDescriptors>
</riaControlsomainDataSource>
<sdkataGrid AutoGenerateColumns="False" Height="200"
ItemsSource="{Binding ElementName=trackDomainDataSource, Path=Data}"
Name="trackDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected"
Width="400">
<sdkataGrid.Columns>
<sdkataGridTextColumn x:Name="albumIdColumn1"
Binding="{Binding Path=AlbumId}" Header="Album Id" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="bytesColumn"
Binding="{Binding Path=Bytes}" Header="Bytes" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="composerColumn"
Binding="{Binding Path=Composer}" Header="Composer" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="genreIdColumn"
Binding="{Binding Path=GenreId}" Header="Genre Id" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="mediaTypeIdColumn"
Binding="{Binding Path=MediaTypeId}" Header="Media Type Id"
Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="millisecondsColumn"
Binding="{Binding Path=Milliseconds}" Header="Milliseconds"
Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="nameColumn"
Binding="{Binding Path=Name}" Header="Name" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="trackIdColumn"
Binding="{Binding Path=TrackId}" Header="Track Id" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="unitPriceColumn"
Binding="{Binding Path=UnitPrice}" Header="Unit Price" Width="SizeToHeader" />
</sdkataGrid.Columns>
</sdkataGrid>
</StackPanel>
</ScrollViewer>
</Grid>
</navigationage>
testing out functionality, I built a simple RIA Business Application against
the Chinook database. I have a datagrid with the albums, another datagrid
with the tracks that ties to the selected album, and a combobox that ties to
the selected album's artist. When I do my first filter (using the built in
filter text box), all works fine, but if I change the filter, the combobox no
longer stays in sync (the datagrid does though). Can you please help? XAML
is as follows:
<navigationage
x:Class="Chinook.Home"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
mc:Ignorable="d" designWidth="640" designHeight="480"
Style="{StaticResource PageStyle}"
xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
xmlns:my="clr-namespace:Chinook.Web.Services"
xmlns:my1="clr-namespace:Chinook.Web.Models"
xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
DataContext="{Binding}">
<sdkage.Resources>
<CollectionViewSource x:Key="albumTracksViewSource" Source="{Binding
Path=Data.Tracks, ElementName=albumDomainDataSource1}" />
</sdkage.Resources>
<Grid x:Name="LayoutRoot">
<ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource
PageScrollViewerStyle}" Margin="-58,0,-58,-10">
<StackPanel x:Name="ContentStackPanel" Style="{StaticResource
ContentStackPanelStyle}">
<TextBlock x:Name="HeaderText" Style="{StaticResource
HeaderTextStyle}"
Text="{Binding
Path=ApplicationStrings.HomePageTitle, Source={StaticResource
ResourceWrapper}}"/>
<TextBlock x:Name="ContentText" Style="{StaticResource
ContentTextStyle}"
Text="Home page content"/>
<riaControlsomainDataSource
AutoLoad="True"
designData="{designInstance my1:Artist,
CreateList=true}"
Height="0" LoadedData="artistDomainDataSource_LoadedData"
Name="artistDomainDataSource"
QueryName="GetArtistsQuery"
Width="0">
<riaControlsomainDataSource.DomainContext>
<my:ChinookContext />
</riaControlsomainDataSource.DomainContext>
</riaControlsomainDataSource>
<ComboBox Height="27"
Name="comboBox1"
Width="398"
ItemsSource="{Binding}"
DataContext="{Binding
ElementName=artistDomainDataSource, Path=Data}"
DisplayMemberPath="Name"
SelectedValuePath="ArtistId"
SelectedValue="{Binding ElementName=albumDataGrid,
Path=SelectedItem.ArtistId, Mode=TwoWay}" />
<riaControlsomainDataSource
AutoLoad="False"
designData="{designInstance my1:Album,
CreateList=true}"
Height="0"
LoadedData="albumDomainDataSource_LoadedData"
Name="albumDomainDataSource"
QueryName="GetAlbumsByStartQuery"
Width="0">
<riaControlsomainDataSource.DomainContext>
<my:ChinookContext />
</riaControlsomainDataSource.DomainContext>
<riaControlsomainDataSource.QueryParameters>
<riaControlsarameter ParameterName="startString"
Value="{Binding ElementName=startStringTextBox, Path=Text}" />
</riaControlsomainDataSource.QueryParameters>
</riaControlsomainDataSource>
<StackPanel Height="30" Orientation="Horizontal">
<sdk:Label Content="Start String:" Margin="3"
VerticalAlignment="Center" />
<TextBox Name="startStringTextBox" Width="60" />
<Button Command="{Binding Path=LoadCommand,
ElementName=albumDomainDataSource}" Content="Load" Margin="3"
Name="albumDomainDataSourceLoadButton"
Click="albumDomainDataSourceLoadButton_Click" />
</StackPanel>
<sdkataGrid AutoGenerateColumns="False" Height="200"
ItemsSource="{Binding ElementName=albumDomainDataSource, Path=Data}"
Name="albumDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected"
Width="400">
<sdkataGrid.Columns>
<sdkataGridTextColumn x:Name="albumIdColumn"
Binding="{Binding Path=AlbumId}" Header="Album Id" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="artistIdColumn"
Binding="{Binding Path=ArtistId}" Header="Artist Id" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="titleColumn"
Binding="{Binding Path=Title}" Header="Title" Width="SizeToHeader" />
</sdkataGrid.Columns>
</sdkataGrid>
<riaControlsomainDataSource
AutoLoad="True"
designData="{designInstance my1:Track,
CreateList=true}"
Height="0"
LoadedData="trackDomainDataSource_LoadedData"
Name="trackDomainDataSource"
QueryName="GetTracksQuery"
Width="0">
<riaControlsomainDataSource.DomainContext>
<my:ChinookContext />
</riaControlsomainDataSource.DomainContext>
<riaControlsomainDataSource.FilterDescriptors>
<riaControls:FilterDescriptor
PropertyPath="AlbumId"
Operator="IsEqualTo"
IgnoredValue=""
Value="{Binding ElementName=albumDataGrid,
Path=SelectedItem.AlbumId, Mode=TwoWay}" >
</riaControls:FilterDescriptor>
</riaControlsomainDataSource.FilterDescriptors>
</riaControlsomainDataSource>
<sdkataGrid AutoGenerateColumns="False" Height="200"
ItemsSource="{Binding ElementName=trackDomainDataSource, Path=Data}"
Name="trackDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected"
Width="400">
<sdkataGrid.Columns>
<sdkataGridTextColumn x:Name="albumIdColumn1"
Binding="{Binding Path=AlbumId}" Header="Album Id" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="bytesColumn"
Binding="{Binding Path=Bytes}" Header="Bytes" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="composerColumn"
Binding="{Binding Path=Composer}" Header="Composer" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="genreIdColumn"
Binding="{Binding Path=GenreId}" Header="Genre Id" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="mediaTypeIdColumn"
Binding="{Binding Path=MediaTypeId}" Header="Media Type Id"
Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="millisecondsColumn"
Binding="{Binding Path=Milliseconds}" Header="Milliseconds"
Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="nameColumn"
Binding="{Binding Path=Name}" Header="Name" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="trackIdColumn"
Binding="{Binding Path=TrackId}" Header="Track Id" Width="SizeToHeader" />
<sdkataGridTextColumn x:Name="unitPriceColumn"
Binding="{Binding Path=UnitPrice}" Header="Unit Price" Width="SizeToHeader" />
</sdkataGrid.Columns>
</sdkataGrid>
</StackPanel>
</ScrollViewer>
</Grid>
</navigationage>