Button.xaml.cs 579 B

123456789101112131415161718
  1. using System.ComponentModel;
  2. namespace CustomControls
  3. {
  4. [DesignTimeVisible(false)]
  5. public partial class Button : ButtonBase
  6. {
  7. // Note regarding style and template:
  8. // <Style x:Key="ButtonStyle1" TargetType="{x:Type Button}"> <-- use the base class here
  9. // <ControlTemplate TargetType="{x:Type local:ButtonBase}"> <-- use this class here
  10. // this way the control will be able to calculate its size correctly (cases: toolbars, autosize buttons)
  11. public Button()
  12. {
  13. InitializeComponent();
  14. }
  15. }
  16. }