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
Hi Kevin,
I am glad that you find my suggestion helpful.
At the time of writing this, there does not seem to be an equivalent to the AllowHiddenColumnIndicator property in the XamDataGrid. This could be suggested as a new product idea for future versions at < https://es.infragistics.com/community/ideas/i/ultimate-ui-for-wpf>. Logging a new product idea enables direct communication with our product management team and allows you to provide additional context as to why this functionality would be beneficial.
All information about the Field Chooser functionality can be found in our documentation here.
Please, let me know if I can assist you with anything else.
Best regards, Bozhidara Pachilova
This helped me, many thanks. Also, is there an equivalent of the XamGrid 'hidden column indicator' in the XamDataGrid?
Hello Kevin,
Thank you for posting to Infragistics Community!
I can see that you are already familiar with the Configuring Template Field topic that suggests leveraging the TemplateEditorValueBinding custom markup extension. It is essentially a shorthand for the following:
{Binding Path=(igWPF:TemplateEditor.Editor).Value, RelativeSource={RelativeSource Self}, UpdateSourceTrigger=PropertyChanged}
Thus you are on the right track and in order to bind to another property of the same data item, a similar binding can be used:
{Binding Path=(igEditors:TemplateEditor.Editor).DataContext.DataItem.UserCanEditDepartment, Converter={StaticResource BoolToEditViewText},RelativeSource={RelativeSource Self}}"
Please, test this suggestion on your side and let me know if it helps.
Best regards,Bozhidara PachilovaAssociate Software Developer