Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1700
Issue with Ancestor
posted

Hello,

I have this project : http://ko.infragistics.com/community/blogs/alex_fidanov/archive/2009/07/14/shortcut-delete-button-on-xamdatagrid.aspx

I have this code : 

<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsActive}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsMouseOver,
RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type custom:DataRecordPresenter}}}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>

How to change it and to get access to items from the xamDataGrid named "Datagrid" ?

regards

  • 34810
    Verified Answer
    Offline posted

    Hello teamtim,

    Thank you for your post!

    I am somewhat unsure of what you are asking to be honest. Would it be possible for you to elaborate a bit further on what you mean by "get access to items from the XamDataGrid named 'Datagrid''? I am currently under the impression that you may possibly want to retrieve the data items that you have bound to the XamDataGrid. If this is not the case, please let me know, as the following goes off of that response.

    The style in the link that you have provided is for the CellValuePresenter. The data context of each of the CellValuePresenters in the XamDataGrid is the data record that that particular CellValuePresenter sits in. Each data record in the XamDataGrid has a DataItem property, which you can use to retrieve the item that that particular DataRecord represents. In other words, if you were to use the following binding for one of your data triggers, you could bind to a property on the underlying data item for a particular row:

    <DataTrigger Binding={Binding DataItem.PropertyName} Value="PropertyValue"/>

    I hope this helps you. Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer
    Infragistics Inc.
    www.infragistics.com/support