Hi,
I have already asked about this feature about a half-year ago. Just in case, asking this one more time :)
Is that possible to draw an icon or bitmap on the row selector? New bitmap should not erase what is already have drawn there.
Thank you.
UPD: I mean I want to draw an image on row selector of any single row, not all of them at the same time.
So there aren't any plans to add a specific feature around this area, however it's always been possible.
In order to do this, you need to first ReStyle and ReTemplate the RowSelector. Then you're going to need to create a Custom ValueConveter.
The following help article can get you started on the ReStyling/ ReTemplating the RowSelector:
http://help.infragistics.com/NetAdvantage/Silverlight/2010.2/CLR4.0/?page=SL_DesignersGuide_Editing_Style_Properties_Using_Expression_Blend.html
In the ControlTemplate you're going to need to add a ContentControl, like so:
<ContentControl Grid.Row="1" Content="{Binding Cell.Row, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource rsvc}}"/>
So, as you see there is a converter specified, this is where you need to write a custom converter to pass in the content.
public class RowSelectorVC : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
The Value you'll receive will be of type Row, so you can then work with it and grab the Data from the row to determine what content you want to display, if you don't want anything to be display, then return null.
Hope this helps,
-SteveZ
Thank you. But is that possible to draw icons depending on some conditions? Just like you draw a pencil when edit a row.
Perhaps a better approach would be to use an UnboundColumn, that is marked as fixed.
This would provide an easier way of displaying custom content.
Then all you'll need to do do is put a button in the ItemTemplate property and listen tot he clicked event.
Stephen:
I am working on something similar can you send me a sample demo. I want to add [+} symbol which when click fires an event to get more detail for that particular row
The symbol can be an image or a hyperlink button
thanks
The name of the property for the Setter is just Template, not ContentTemplate.
So change:
<Setter Property="ContentTemplate">
To<Setter Property="Template">
This is my style for RowSelector:
<Controls:RowSelectorSettings Visibility="Visible" EnableRowNumbering="True" > <Controls:RowSelectorSettings.Style> <Style TargetType="Primitives:RowSelectorCellControl"> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <ContentControl Content="{Binding Cell.Row, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource rsvc}}"/> </DataTemplate> </Setter.Value> </Setter> </Style> </Controls:RowSelectorSettings.Style> </Controls:RowSelectorSettings>
And I get an XamlParseException
System.Windows.Markup.XamlParseException: Property "ContentTemplate" not found in type "Infragistics.Controls.Grids.Primitives.RowSelectorCell". [Line: 35 Position: 30]
What is wrong there?
You can use he various VisualStates of the RowSelector to determine what should be drawn.
For example, you can use the "Editing" VisualState to draw a custom icon for editing.