I have a grid where I want to take the text from that cell, convert it to an image and send it back to the grid.
Here is my template code:
<DataTemplate x:Key="categoryCellTemplate">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
</Grid.RowDefinitions>
<Image Grid.Column="0"
Margin="1,1,4,1"
VerticalAlignment="Center"
Source="{Binding Converter={StaticResource catConverter}}"
/>
</Grid>
</DataTemplate>
and here is my xaml code:
<Grid>
<xcdg:DataGridControl Height="311"
HorizontalAlignment="Left"
Name="dataGridControl1"
VerticalAlignment="Top"
Width="503"
ItemsSource="{Binding Source={StaticResource Clients}}">
<xcdg:DataGridControl.Columns>
<xcdg:Column FieldName="Name" />
<xcdg:Column FieldName="Age" />
<xcdg:Column FieldName="Category" />
<xcdg:Column FieldName="Color"
CellContentTemplate="{StaticResource categoryCellTemplate}" />
<xcdg:Column FieldName="DOB" />
</xcdg:DataGridControl.Columns>
</xcdg:DataGridControl>
</Grid>
where i am having trouble in the template code is to specify what the parameter is…. since he data is bound, I dont know how to send it to the converter class.. please help!!
It depends what kind of parameter you want to pass. You can use the
ConverterParamterlike thishowever the
ConverterParameteris not a dependency property so you cannot use binding. If you want to supply dynamic context you would need to use multi binding and a multi value converter like this: