From: Allen Chen [MSFT] on
Hi Gerhard,

>However, I still don't see that the binding between the two is working.
>When I put 'ba' into the start string, all is working fine. When I change
>the 'ba' to 'bach' and load, the combobox does not select the correct
artist.

It looks like a known issue of ComboBox databinding. You probably have to
manually bind to workaround. i.e. In albumDataGrid_SelectionChanged and
artistComboBox_SelectionChanged manually sync the DataGrid and ComboBox.

>Also, if I take out the submitchanges from the code behind, the start
string
>and load button stay disabled. I'm not always going to want a save to be
>automatic on any change in a combo box selection.

The cause of this behavior is, the DomainDataSource keeps tracking changes
of data it retrieved. If data is changed it doesn't allow load operation
before submitting changes. To workaround this issue you can use cached data
source instead of using Data of DomainDataSource.

First please refer ItemsSource definition of albumDomainDataSource in xaml.
Then use following code instead:

private void albumDomainDataSource_LoadedData(object sender,
LoadedDataEventArgs e)
{

if (e.HasError)
{
System.Windows.MessageBox.Show(e.Error.ToString(), "Load
Error", System.Windows.MessageBoxButton.OK);
e.MarkErrorAsHandled();
}
else {
DomainDataSourceView ddsv=
(DomainDataSourceView)albumDomainDataSource.Data;
List<Album> list = new List<Album>();// You may use global
variable instead to cache data source.
foreach (Album album in ddsv)
{
// use cached data instead to avoid tracking changes of
original data
Album cacheddata = new Album() { Artist = album.Artist,
ArtistId = album.ArtistId };
list.Add(cacheddata);
}
this.albumDataGrid.ItemsSource = list;
}

}

When you want to save changes you can manually assign cached data to Data
of DomainDataSource and submit changes.

>Are the development folks working to get the combo box working as expected
>before they release the product?

Our product team is working on it. But as far as I can tell unfortunately
some of the known issues of CombBox are not likely to be fixed in SL 4 RTW
(we'll do our best, however, to fix as much as possible before RTW). We
will address these issues in SL 5. If you have any problems in CombBox
please let me know. I think we can find workarounds for most of these known
issues.

>One other question, how do I get the Load button to fire when hit enter
>after putting in a start string?

You can refer to the following blog:
http://azurecoding.net/blogs/icbtw/archive/2009/09/02/xaml-default-button.as
px

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg(a)microsoft.com.

From: Gerhard on
Thanks for your feedback. I was hoping that SL4 would fix the combo box (I
have work arounds that are working in SL3) so it would be cleaner and easier
to maintain. Please let me know if it does get fixed.

Have a happy day!



"Allen Chen [MSFT]" wrote:

> Hi Gerhard,
>
> >However, I still don't see that the binding between the two is working.
> >When I put 'ba' into the start string, all is working fine. When I change
> >the 'ba' to 'bach' and load, the combobox does not select the correct
> artist.
>
> It looks like a known issue of ComboBox databinding. You probably have to
> manually bind to workaround. i.e. In albumDataGrid_SelectionChanged and
> artistComboBox_SelectionChanged manually sync the DataGrid and ComboBox.
>
> >Also, if I take out the submitchanges from the code behind, the start
> string
> >and load button stay disabled. I'm not always going to want a save to be
> >automatic on any change in a combo box selection.
>
> The cause of this behavior is, the DomainDataSource keeps tracking changes
> of data it retrieved. If data is changed it doesn't allow load operation
> before submitting changes. To workaround this issue you can use cached data
> source instead of using Data of DomainDataSource.
>
> First please refer ItemsSource definition of albumDomainDataSource in xaml.
> Then use following code instead:
>
> private void albumDomainDataSource_LoadedData(object sender,
> LoadedDataEventArgs e)
> {
>
> if (e.HasError)
> {
> System.Windows.MessageBox.Show(e.Error.ToString(), "Load
> Error", System.Windows.MessageBoxButton.OK);
> e.MarkErrorAsHandled();
> }
> else {
> DomainDataSourceView ddsv=
> (DomainDataSourceView)albumDomainDataSource.Data;
> List<Album> list = new List<Album>();// You may use global
> variable instead to cache data source.
> foreach (Album album in ddsv)
> {
> // use cached data instead to avoid tracking changes of
> original data
> Album cacheddata = new Album() { Artist = album.Artist,
> ArtistId = album.ArtistId };
> list.Add(cacheddata);
> }
> this.albumDataGrid.ItemsSource = list;
> }
>
> }
>
> When you want to save changes you can manually assign cached data to Data
> of DomainDataSource and submit changes.
>
> >Are the development folks working to get the combo box working as expected
> >before they release the product?
>
> Our product team is working on it. But as far as I can tell unfortunately
> some of the known issues of CombBox are not likely to be fixed in SL 4 RTW
> (we'll do our best, however, to fix as much as possible before RTW). We
> will address these issues in SL 5. If you have any problems in CombBox
> please let me know. I think we can find workarounds for most of these known
> issues.
>
> >One other question, how do I get the Load button to fire when hit enter
> >after putting in a start string?
>
> You can refer to the following blog:
> http://azurecoding.net/blogs/icbtw/archive/2009/09/02/xaml-default-button.as
> px
>
> Regards,
> Allen Chen
> Microsoft Online Support
>
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg(a)microsoft.com.
>
> .
>