I have a valueconverter attached to an unbound column in a xamwebgrid. When i debug the valueconverter, the UnboundColumnDataContext.RowData and Value are both nothing. Here is the Xaml. Maybe I have not set this up correctly:
<ig:UnboundColumn Key="Attachment" HeaderText="" IsSummable="False" ValueConverter="{StaticResource TransactionAttachment}"> <ig:UnboundColumn.ItemTemplate> <DataTemplate> <Image Stretch="Fill" Width="16" Height="16" Source="{Binding RowData}" /> </DataTemplate> </ig:UnboundColumn.ItemTemplate></ig:UnboundColumn>
Hi,
Perhaps your TransactionAttachment resource isn't being found?
Is your ValueConverter's Convert method being called?
-SteveZ
Yes it is being called. I stepped through it. When I examine the value parameter, it is of type UnboundColumnDataContext. The key property is set correctly ("Attachment" - the key for the column), but both the RowData and Value properties are nothing.
I don't. Its on my development machine. Don't know if it matters, but the ItemsSource for the grid is set at runtime - its a linqtosql entity (ria service). I tried setting the valueconverter both at runtime and in xaml but it didn't make any difference. That particular grid makes use of several valueconverters all of which are working properly, but none of them are on unbound columns.
Here's the convert function:
Public Function Convert(ByVal value As Object, ByVal targetType As System.Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert Dim t As Transaction = DirectCast(DirectCast(value, Infragistics.Silverlight.UnboundColumnDataContext).RowData, Transaction) Dim ctx As ComdataDS = DirectCast(parameter, ComdataDS) If ctx.Documents.Select(Function(d) d.TransactionKey = t.TransactionKey).Count > 0 Then Return New Uri(Application.Current.Host.Source, "../images/attachment.png") Else Return String.Empty End IfEnd Function
Hmm...
That appears to be the issue, The value being returned in the Converter should not be a UnboundColumnDataContext, it should be the data for that particular row.
Are you using the latest Service Release?
I thought an unbound column was supposed to make use of an unboundcolumndatacontext? I'll check and see if the service release I installed was the latest.
It looks like I have the most recent release. My components have a version of 10.1.20101.2022.
I downloaded and installed it and now it works perfectly.
Thanks.
Service Release has just been released, you can go to the download site and get it.
Build numbers are:
HTH,
Hi Stoimen,
Thanks, I will test it as soon as the service release is available.
Remko
As SteveZ mentioned above, the type of the object which is passed in to the Convert() method shound not be of type UnboundColumnDataContext, but of the type of your data object.
I managed to reproduce a case where the Convert() method is being called with value of type UnboundColumnDataContext (with the build numbers you provided), so I think that's the issue you are running into.
I verified that this issue is fixed with the latest Service Release which is comming very soon.
I hope your issues will be solved,
I'm having the same issue with version 10.2.20102.1029. Was this problem solved by anyone?