AgDataGrid - CslaDataProvider - Converter

AgDataGrid - CslaDataProvider - Converter

Old forum URL: forums.lhotka.net/forums/t/6284.aspx


davido_xml posted on Thursday, January 29, 2009

Hi,

Silverlight usercontrol with 2 user resources;

1) for the categories data (name-value pairs)

2) the value converter (value->name; name->value)

Using an AgDataGrid with a binding like this (more detail below):

<TextBlock Text="{Binding Path=CategoryId, Converter={StaticResource CategoriesConverter}, ConverterParameter={StaticResource CategoriesData}, Mode=TwoWay}" />

In my Convert method provider.Data is always null. I know the provider is populating because I have another grid that just lists the name-value pairs in the CslaDataProvider. Is this some async out of sequence issue? Any advice appreciated.

public object Convert(object value, Type targetType, object parameter, CultureInfo culture){

Csla.Silverlight.CslaDataProvider provider = parameter as Csla.Silverlight.CslaDataProvider;

if (value != null && provider != null && provider.Data != null)

 

<csla:CslaDataProvider x:Key="CategoriesData" ManageObjectLifetime="True" IsInitialLoadEnabled="True"

ObjectType="xxx.Categories, xxx, Version=..., Culture=neutral, PublicKeyToken=null"

DataChanged="CslaDataProvider_DataChanged"

FactoryMethod="GetCategories" />

<local:CategoriesConverter x:Key="CategoriesConverter"></local:CategoriesConverter>

<aggrid:AgDataGridColumn FieldName="CategoryId" HeaderContent="Converted CategoryId">

<aggrid:AgDataGridColumn.CellDisplayTemplate>

<DataTemplate>

<TextBlock Text="{Binding Path=CategoryId, Converter={StaticResource CategoriesConverter}, ConverterParameter={StaticResource CategoriesData}, Mode=TwoWay}" />

</DataTemplate>

</aggrid:AgDataGridColumn.CellDisplayTemplate>

</aggrid:AgDataGridColumn>

Copyright (c) Marimer LLC