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
1060
XamDataGrid TemplateField Binding Question
posted

Hi,

I'm sure I'm missing something obvious here but I'm trying to migrate the following from the XamGrid to the XamDataGrid.

Here's the XamGrid xaml.  You can see that within the template I am binding to two different properties on the object, DepartmentId (which is the Key) and UserCanEditDepartment (which is another property on the object).

<ig:TemplateColumn Key="DepartmentId">
<ig:TemplateColumn.ItemTemplate>
<DataTemplate>
<cc:HyperlinkButton NavigateUri="{Binding DepartmentId, Converter={StaticResource uriConverter}, ConverterParameter='DepartmentEdit'}"
Content="{Binding UserCanEditDepartment, Converter={StaticResource BoolToEditViewText}}" />
</DataTemplate>
</ig:TemplateColumn.ItemTemplate>
</ig:TemplateColumn>

Here's my XamDataGrid xaml that is not working in respect of the UserCanEditDepartment binding.

<igDP:TemplateField Name="DepartmentId">
<igDP:TemplateField.DisplayTemplate>
<DataTemplate>
<cc:HyperlinkButton NavigateUri="{Binding igEditors:TemplateEditorValueBinding, Converter={StaticResource uriConverter}, ConverterParameter='DepartmentEdit'}"
Content="{Binding UserCanEditDepartment, Converter={StaticResource BoolToEditViewText}}" />
</DataTemplate>
</igDP:TemplateField.DisplayTemplate>
</igDP:TemplateField>

The error I get is......... System.Windows.Data Error: 40 : BindingExpression path error: 'UserCanEditDepartment' property not found on 'object' ''Int32' (HashCode=116)'. BindingExpression:Path=UserCanEditDepartment; DataItem='Int32' (HashCode=116); target element is 'HyperlinkButton' (Name=''); target property is 'Content' (type 'Object')

What binding do I need to use in order to get to the UserCanEditDepartment property on the same object as the key of DepartmentId is a property?

Thanks,

Kevin