Hi,
Is there an example of the Xaml syntax for a multibinding valueconverter for an UnboundColumn or TextColumn for XamGrid?
Thanks
Hello Murray,
Thank you for your post. I have been looking into it and if I understand correctly, you wish to display the values of multiple properties of your data items in one column. If this is correct, I can suggest using an UnboundColumn and using its ItemTemplate to display several of the properties of your data. The DataContext of the ItemTemplate is an UnboundColumnDataContext object, which has property called RowData, that corresponds to the object of the Row and you can use it in order to get the data that you need. I have created a sample application for you, that shows how you can implement the approach I have described.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
Krasimir,
Sorry didn't make myself clear. All Iwant to be able to do is to call an iMultiValueConverter for a column I'm adding to a grid from a hierarchical obejct set. I've no probelm with calling iValueconverter for single values but don't know the syntax in a Xamgrid to call an iMultiValueConvertor.
Jim
Hello Jim,
Thank you got your reply. I have been looking into it and I am not completely sure when in the XamGrid you are trying to use IMultiValueConverter. The IMultiuValueConverter is used to provide the ability to apply logic when you are using MultiBinding for a DependencyProperty. You can read more detailed description on that interface here: http://msdn.microsoft.com/en-us/library/system.windows.data.imultivalueconverter.aspx.
Would please provide me with more detailed description, where you creating using IValueConverter in the XamGrid and what is the MultiBinding that you are creating, for the IMultiValueConverter?
Looking forward to hearing from you.
Here is an example of the type of multivalueconverter I want to call:-
[
ValueConversion(typeof(object), typeof(string))]
public class LotConverter : IMultiValueConverter
{
#region
IMultiValueConverter Members
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
// Values coming in are:
//
// Lot
// LotSequence
string lot = values[0] as string;
int? lotSequence = values[1] as int?;
return (String.Format("{0}/{1}", lot, lotSequence));
}
In a list control I use the following to call it:-
<DataTemplate x:Key="LotTemplate">
<TextBlock>
<TextBlock.Text>
<MultiBinding Converter="{StaticResource lotConverter}">
<Binding Path="LotCode"/>
<Binding Path="LotSequence"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
How do i do this when using an Xamgrid. In the example below I'm calling a valueconverter as I'm only need to pass in a single value. how do I do it if I need to pass in more than one value?
<
ig:ColumnLayout.Columns>
<ig:TextColumn Key="ShiftId" HeaderText="Shift" ValueConverter="{StaticResource shiftTitle}" IsReadOnly="True"/>
Regards
jim
Thank you for your reply. I have been looking into it and the ValueConverter property of the TextColumn should be set to a IValueConverter instance, since it is used in the binding to the value of the cells of that column, which is not a MultiBinding and as I have mentioned, the IMultiValueConverter is used for MultiBinding only. What I can suggest in order to use binding, similar to the one that you have metioned, is using an UnboundColumn and defining your binding in its ItemTemplate. I have modified the sample application that I have previously attached, in order to demonstrates how you can use MultiBinding, in the ItemTemplate of an UnboundColumn.
Please let me know if need any further assistance on the matter.
Thanks very much for your ehlp. That's exactly what I needed.
Hello James,
Thank you for your reply. I am very glad that the approach I have suggested was helpful for you. Please let me know if need any further assistance on the matter.