在silverlight里自定义一个控件ReplicationEventComboBox继承ComboBox,在ReplicationEventComboBox类里面定义依赖属性TextProperty。
其中ReplicationEventComboBox中 private TextBlock _text; 字段在方法OnApplyTemplate()中被赋值 var text = this.GetTemplateChild("X_Text") as TextBlock;
if (text != null)
{
_text = text;
SetDisplayContent(false);
}。
现在在图中SetText方法中 control._text 为空 。 导致赋值时出错
求大神帮忙解答一下。