WPF custom derived control style

前端 未结 5 1232
难免孤独
难免孤独 2021-01-04 22:04

I have a custom control derived from Button:

    class MyControl : Button{}

And suppose, this class is empty (has no members).

In t

5条回答
  •  独厮守ぢ
    2021-01-04 22:52

    For doing this completely in code this answer on another forum works

    this.Style = new Style(GetType(), this.FindResource(typeof(System.Windows.Controls.Button)) as Style);
    

提交回复
热议问题