I am looking for some event or command that would be executed only after a row has been added to a XamDataGrid - meaning the RecordItem and all of its contained elements have been created.
I understand that normally people will handle the CollectionChanged event on Observable collections that are bound to the XamDataGrid but I need to be notified after the RecordItem has been fully instantiated.
Hello Jerry,
Thank you for your replies. I am very glad that you have managed to implement your requirements. Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir, MCPD
Developer Support Supervisor - XAML
Infragistics
www.infragistics.com/support
I found what I need - the CellValuePresenter has an Editor property exposed through the base ValuePresenter class which by default is the XamTextEditor that can be used to animate the Foreground of the cell.
One update on this - I spoke to a friend to was able to effectively animate CVPs by using the various Foreground Styles on a CVP but I am trying to do this with animations.
Some more information - I was actually able to animate the background of a cell by creating an animation and adding it to the resources of the CellValuePresenter in a cell, but only to animate the Background like so:
DependencyProperty[] propertyChain1 = new DependencyProperty[] { CellValuePresenter.BackgroundProperty, SolidColorBrush.ColorProperty };
This is good news because it means that I can apply animations to a CellValuePresenter rather than having to find whatever control is actually displaying the content, but the problem is that I am trying to animate the Foreground, and using CellValuePresenter.ForegroundProperty is not working.
Thank you for your reply. I have been looking into your description and we are providing a class called Utilities, that has static methods that allow finding elements of the visual tree that you can use to access the elements of the CellValuePresenter that you need. If you are using a ContentTemplate for the CellValuePresenter, you can set x:Name attribute of the elements of the DataTempalte and then you can use Utilities’ GetDescendentFromName method to get your element:
XAML:
<Style TargetType="{x:Type igWPF:CellValuePresenter}" x:Key="cellStyle">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Label
x:Name="label"
Content="{Binding RelativeSource={RelativeSource AncestorType={x:Type igWPF:CellValuePresenter}}, Path=Value}"
VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
C#:
Label label = Utilities.GetDescendantFromName(e.CellValuePresenter, "label") as Label;
if (label != null)
{
//Do something
}
IF you use the default style, the element that the cell uses to display the value is an editor and you can access it using the GetDescendentFromType method as follow (the example is for the text editor):
XamTextEditor editor = Utilities.GetDescendantFromType(
e.CellValuePresenter,
typeof(XamTextEditor),
false) as XamTextEditor;
if (editor != null)
I am attaching a modified version of the sample that contains this approach.
Please let me know if you need any further assistance on the matter.