We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

AncestorType for a button inside a column of a Master-Details datagrid

Thread ID:





120887 Oct 25,2015 01:55 PM UTC Oct 27,2015 04:20 AM UTC WPF 3
Tags: SfDataGrid
Asked On October 25, 2015 01:55 PM UTC


I have a button that launch a specifi command inside a column of my datagrid, in the details part of a master-details.

The button command is define as also :

Command="{Binding DataContext.SupprimerVilleCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type syncfusion:SfDataGrid}}}"

But the command is never launched, and an error is displayed in Visual Studio output window :

System.Windows.Data Error: 40 : BindingExpression path error: 'SupprimerDepartementCommand' property not found on 'object' ''EntityCollection`1' (HashCode=39200294)'. BindingExpression:Path=DataContext.SupprimerDepartementCommand; DataItem='DetailsViewDataGrid' (Name=''); target element is 'Button' (Name=''); target property is 'Command' (type 'ICommand')

What is the correct AncestorType to specify in this case ?

Thanks for your help.


Jai Ganesh S [Syncfusion]
Replied On October 26, 2015 12:19 PM UTC


Thank you for using Syncfusion Products.

You can achieve your requirement to launch the button command inside the details view datagrid column by setting the AncestorLevel based on the details grid level like the below code example,
Code Example:

<syncfusion:GridTemplateColumn MappingName="CustomerID" syncfusion:FocusManagerHelper.WantsKeyInput="True">



             <Button  Content="Click" syncfusion:FocusManagerHelper.FocusedElement="True"

        Command="{Binding Path=DataContext.ToggleExecuteCommand,RelativeSource={RelativeSource AncestorLevel=2, AncestorType=syncfusion:SfDataGrid}}" />



We have prepared a sample based on this and you can download the sample from the below location,

Sample: http://www.syncfusion.com/downloads/support/directtrac/145693/ze/MasterDetailsViewDemo-255495418

Please let us know if you need further assistance.

Jai Ganesh S

Replied On October 26, 2015 05:54 PM UTC

Thanks it works perfectly...

Jai Ganesh S [Syncfusion]
Replied On October 27, 2015 04:20 AM UTC


Thank you for the update.

Please let us know if you need further assistance on this.

Jai Ganesh S


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon