Hello,
Is there a way to chage the sort indicator images? I mean the up and down arrows displayed on the header when sorting is ascending or descendig
Thanks for the answer Brian.
I've been very busy lately, but I'll try your suggestion as soon as I get a chance.
Yes; the following code sample demonstrates how using the IUIElementCreationFilter interface:
this.ultraListView1.CreationFilter = new SortIndicatorCreationFilter( ascendingImage, descendingImage );
public class SortIndicatorCreationFilter : IUIElementCreationFilter{ private Image imageAsc = null; private Image imageDesc = null;
public SortIndicatorCreationFilter( Image imageAsc, Image imageDesc ) { this.imageAsc = imageAsc; this.imageDesc= imageDesc; }
void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent) { UltraListViewColumnHeaderUIElement headerElement = parent as UltraListViewColumnHeaderUIElement; if ( headerElement != null ) { UltraListViewSortIndicatorUIElement sortIndicator = headerElement.GetDescendant( typeof(UltraListViewSortIndicatorUIElement) ) as UltraListViewSortIndicatorUIElement;
if ( sortIndicator != null ) { UltraListViewColumnBase column = headerElement.Column; Sorting sorting = column.Sorting; Image image = sorting == Sorting.Ascending ? this.imageAsc : this.imageDesc; Rectangle rect = sortIndicator.Rect; headerElement.ChildElements.Remove( sortIndicator ); ImageUIElement imageElement = new ImageUIElement( headerElement, image ); imageElement.Rect = rect; headerElement.ChildElements.Add( imageElement ); } } }
bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent) { return false; }}