OnApplyTemplate not called in Custom Control

前端 未结 6 2057
忘掉有多难
忘掉有多难 2021-02-01 21:47

I have a Custom Control which uses some PART controls:

 [TemplatePart(Name = \"PART_TitleTextBox\", Type = typeof(TextBox))]
    [TemplatePart(Name = \"PART_Titl         


        
6条回答
  •  终归单人心
    2021-02-01 22:48

    I can't see your constructor, but don't forget to set the DefaultStyleKey:

    DefaultStyleKeyProperty.OverrideMetadata(typeof(TitleBoxNew), new FrameworkPropertyMetadata(typeof(TitleBoxNew)));
    

提交回复
热议问题