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
}

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2021-09-01
  • 2021-11-20
猜你喜欢
  • 2021-12-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-10
  • 2021-09-14
  • 2021-07-23
相关资源
相似解决方案