189 8069 5689

wpf性能问题

1,wpf最好使用通用模板,使用StaticResource引用样式

囊谦网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设公司等网站项目制作,到程序开发,运营维护。创新互联成立于2013年到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联

2,释放事件。每个UserControl,Page,Window都实现一个接口

    interface IUIElement : IDisposable
   {
       ///
       /// 注册事件
       ///

       void EventsRegistion();

       ///
       /// 解除事件注册
       ///

       void EventDeregistration();
   }

来注册事件和解除事件

3,定时回收垃圾

DispatcherTimer GCTimer=new DispatcherTimer();
public MainWindow()
{
   InitializeComponent();
   this.GCTimer.Interval= TimeSpan.FromMinutes(10);//垃圾释放定时器 我定为每十分钟释放一次,大家可根据需要修改
 this.GCTimer.start();

   this.EventsRegistion();    // 注册事件
}

publicvoid EventsRegistion()
{
   this.GCTimer.Tick+=new EventHandler(OnGarbageCollection);
}

publicvoid EventDeregistration()
{
   this.GCTimer.Tick-=new EventHandler(OnGarbageCollection);
}

void OnGarbageCollection(object sender, EventArgs e)
{
   GC.Collect();
   GC.WaitForPendingFinalizers();
   GC.Collect();
}

网页题目:wpf性能问题
本文来源:http://cdxtjz.cn/article/jjdpgj.html

其他资讯