Make TableViewTemplateColumn use ClipboardContentBinding#355
Make TableViewTemplateColumn use ClipboardContentBinding#355Mangepange wants to merge 2 commits intow-ahmad:mainfrom
Conversation
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public override object? GetCellContent(object? dataItem) |
There was a problem hiding this comment.
I think this could cause some confusion, so maybe we should add a property to enable or disable this behavior.
There was a problem hiding this comment.
Do you mean for the export? If not providing a value for the ClipboardContentBinding I believe everything works as before. Both copying and exporting. But maybe I could add an ExportContentBinding property to the template column to separate them if you think that is better?
There was a problem hiding this comment.
I just realized that GetCellContent is also used for filtering and sorting, so yeah, probably confusing.
There was a problem hiding this comment.
I added a new property to the TableViewTemplateColumn, OperationContentBinding. If set, it's used to provide cell content to sorting, filtering, exporting.
There was a problem hiding this comment.
I think this is a good approach. Maybe we should move it to the base column so the other columns can use it as well.
…option to use a binding for sorting, exporting, filtering
|
|
||
| if (_funcCompiledPropertyPath is null && !string.IsNullOrWhiteSpace(ClipboardContentBindingPropertyPath)) | ||
| _funcCompiledPropertyPath = dataItem.GetFuncCompiledPropertyPath(ClipboardContentBindingPropertyPath!); | ||
| if (_funcCompiledPropertyPath is null) |
There was a problem hiding this comment.
This would cause null values to be returned if the PropertyPath is null. For example, if the TableView is bound to a collection like List<int>, the column binding wouldn’t have any path, so with this change, the value would always be null when it shouldn’t be. Let's revert this change.
| } | ||
|
|
||
| /// <inheritdoc/> | ||
| public override object? GetCellContent(object? dataItem) |
There was a problem hiding this comment.
I think this is a good approach. Maybe we should move it to the base column so the other columns can use it as well.
This is a fix for #347
TableViewTemplateColumn now gets to use the ClipboardContentBinding.
If this property is not set, the result is as previous, the clipboard and export is empty for these columns. (If it weren't for the new "return null" in TableViewColumn.GetClipboardContent, the cell would return the datacontext type name)
I also fixed the same issue when exporting. Since there's no Binding property on template columns, I figured that a reasonable behavior would be to use the ClipboardContentBinding during export as well.