开发者

XAML control to inherit from templates

What controls are there to inherit from that has the property of Children and supports templating when building a custom usercontrol.

Currently I know about Panel, but it does not support prope开发者_高级运维rties and methods like DefaultStyleKey and GetTemplateChild();

Is there an interface that I can inherit from for templates such as:

public class Scroller : Panel, ITemplates //Something like ITemplates
{
   public override void OnApplyTemplate()
   {
        base.OnApplyTemplate();
        container = GetTemplateChild("container") as StackPanel; //I want to be able to do this

        this.Children; //And also be able to use this
   }
}


You want ItemsControl. It has an Items property and its template is very flexible as demonstrated by the fact that TabControl, ListBox, ComboBox, etc all derive from it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜