Hi
i have sorted my first columns in ascending order. After that i want to disable sorting on every column and Also want to hide SortIndicator on column's header?
Regards
Asad
Hi Asad,
To prevent the user from sorting, set the HeaderClickAction property on the override to something other than one of Sort options. To get rid of the sort indicator, you will need to write a creation filter that removes the sort indicator element. See the grid's CreationFilter property for more information on how to implement a creation filter.
Hope this helps,
Sandip
I added a creation filter to resolve this same issue and now I'm having other problems.
The creation filter takes focus away from the grid after it draws so now my focus events don't work.
It seems there are a lot of people trying to do this same simple task. It would be nice to have it built into the grid.
Hi,
I don't see how a CreationFilter could affect focus. All it needs to do is remove a UIElement and UIElements are only representations of visual objects in the UI. They should never have any effect on focus - except maybe when you click on one, the Control UIElement gives focus to the control sometimes.
Can you post a small sample project demonstrating the focus problem so I can take a look?
I whipped up a quick CreationFitler to test this and it's a pretty simple one, so I can't see how it could ever affect the grid's focus.
internal class NoSortIndicatorsCreationFilter : IUIElementCreationFilter { #region IUIElementCreationFilter Members void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent) { if (parent is HeaderUIElement) { UIElement sortIndicatorUIElement = parent.GetDescendant(typeof(SortIndicatorUIElement)); if (sortIndicatorUIElement != null) parent.ChildElements.Remove(sortIndicatorUIElement); } } bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent) { return false; } #endregion }