zoukankan      html  css  js  c++  java
  • WPF : UserControl的Initialized事件不会触发

    UserControl必须实现ISupportInitialize接口.

    /// <summary>
    /// Implement ISupportInitialize so that the Initialized event can be attached in XAML.
    /// A known bug is that the BeginInit/EndInit will be called twice in WPF 3.*.
    /// </summary>

    public partial class UcTaskItemNote : ISupportInitialize
    {
        
    private int mInitCalledCount = 0;

        
    #region ISupportInitialize Members

        
    void ISupportInitialize.BeginInit()
        {       
            
    if(this.mInitCalledCount == 0)
            {
                
    return;
            }
            
    base.BeginInit();
        }

        
    void ISupportInitialize.EndInit()
        {
            
    if (this.mInitCalledCount == 0)
            {
                
    this.mInitCalledCount++;
                
    return;
            }
            
    base.EndInit();
        }

        
    #endregion
    }
  • 相关阅读:
    键值表
    CRC校验方法
    extern 使用
    编码格式简介(ANSI、GBK、GB2312、UTF-8、GB18030和 UNICODE)
    学习积累
    二分查找写法
    生活技术常识
    JAVA实例
    JAVA_Sprint学习(一)
    手把手使用Git?
  • 原文地址:https://www.cnblogs.com/mrfangzheng/p/1610121.html
Copyright © 2011-2022 走看看