public CurButtom() { TextBlock textBlock = new TextBlock(); this.Child = textBlock; textBlock.VerticalAlignment = VerticalAlignment.Center; textBlock.HorizontalAlignment = HorizontalAlignment.Center; textBlock.BindTo(TextBlock.TextProperty, new Binding() { Source = this, Path = new PropertyPath("Text") }); textBlock.BindTo(TextBlock.FontFamilyProperty, new Binding() { Source = this, Path = new PropertyPath("FontFamily") }); textBlock.BindTo(TextBlock.FontSizeProperty, new Binding() { Source = this, Path = new PropertyPath("FontSize") }); textBlock.BindTo(TextBlock.ForegroundProperty, new Binding() { Source = this, Path = new PropertyPath("Foreground") }); textBlock.Margin = new Thickness(5, 5, 5, 5); this.MouseDown += CurButtom_MouseDown; this.MouseUp += CurButtom_MouseUp; this.MouseLeave += CurButtom_MouseLeave; this.IsSelected = false; }