Click here to Skip to main content
15,896,063 members
Articles / Desktop Programming / WPF

Wrap Panel Virtualization

Rate me:
Please Sign up or sign in to vote.
4.95/5 (18 votes)
2 Jan 2012CPOL2 min read 53.7K   5.6K   41  
WrapPanel doesn't support virtualization. But we can improve the performance by simulating virtualization.
using System;
using System.ComponentModel.Composition;
using System.Windows;
using MediaAssistant.Controls.Dialog;
using MediaAssistant.Helper;
using MefBasic;

namespace MediaAssistant.Controls.SmartDJPreferance
{
    [Export]
    [PartCreationPolicy(CreationPolicy.NonShared)]
    public class SmartDJPreferancePresenter:APresenter<SmartDJPreferanceView>, IDialogContentPresenter
    {
        [ImportingConstructor]
        public SmartDJPreferancePresenter(SmartDJPreferanceView view) : base(view)
        {
        }

        #region Implementation of IDialogContentPresenter

        public bool OnClosing(DialogResult dialogResult)
        {
            return true;
        }

        public int GenrePreferance
        {
            get { return (int)GetValue(GenrePreferanceProperty); }
            set { SetValue(GenrePreferanceProperty, value); }
        }

        public static readonly DependencyProperty GenrePreferanceProperty =
            DependencyProperty.Register("GenrePreferance", typeof(int), typeof(SmartDJPreferancePresenter), new UIPropertyMetadata(RegistryHelper.GenrePreferance));



        public int AlbumPreferance
        {
            get { return (int)GetValue(AlbumPreferanceProperty); }
            set { SetValue(AlbumPreferanceProperty, value); }
        }

        public static readonly DependencyProperty AlbumPreferanceProperty =
            DependencyProperty.Register("AlbumPreferance", typeof(int), typeof(SmartDJPreferancePresenter), new UIPropertyMetadata(RegistryHelper.AlbumPreferance));



        public int ArtistPreferance
        {
            get { return (int)GetValue(ArtistPreferanceProperty); }
            set { SetValue(ArtistPreferanceProperty, value); }
        }

        public static readonly DependencyProperty ArtistPreferanceProperty =
            DependencyProperty.Register("ArtistPreferance", typeof(int), typeof(SmartDJPreferancePresenter), new UIPropertyMetadata(RegistryHelper.ArtistPreferance));




        public int ComposerPreferance
        {
            get { return (int)GetValue(ComposerPreferanceProperty); }
            set { SetValue(ComposerPreferanceProperty, value); }
        }

        public static readonly DependencyProperty ComposerPreferanceProperty =
            DependencyProperty.Register("ComposerPreferance", typeof(int), typeof(SmartDJPreferancePresenter), new UIPropertyMetadata(RegistryHelper.ComposerPreferance));


        #endregion
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) KAZ Software Limited
Bangladesh Bangladesh
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions