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
25
Thumbnail ListView -> white border around picture
posted

I adjusted the following properties of ListView:

ImageSize = new Size(100,100);

ItemSize = new Size(100,100);

Spacing = new Size(0,0);

But there some border (space between blue selection frame and image) exists. And

How can I change it?

  • 69832
    Verified Answer
    Offline posted

    There is no way to change that through the public object model; this view was based on the pre-Vista WIndows Explorer which also did not provide any way to change that. If you like you can submit a feature request for the ability to do this.

    Note that you can work around this limitation in the meantime using the IUIElementCreationFilter interface (assign an instance of this class to the control's CreationFilter property):

    #region ThumbnailCreationFilter
    public class ThumbnailCreationFilter : IUIElementCreationFilter
    {
        UltraListView listView = null;
        public ThumbnailCreationFilter( UltraListView listView ) { this.listView = listView; }

        #region IUIElementCreationFilter Members

        void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent)
        {
            if ( parent is UltraListViewIconicImageAreaUIElement )
            {
                ImageUIElement imageElement = parent.GetDescendant( typeof(ImageUIElement) ) as ImageUIElement;
                if ( imageElement != null )
                {
                    Rectangle rect = parent.Rect;
                    rect.Inflate( -4, -4 );
                    imageElement.Rect = rect;                   
                    imageElement.Scaled = true;
                }
            }
        }

        bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent)
        {
            return false;
        }

        #endregion
    }
    #endregion ThumbnailCreationFilter