using System.Windows; using System.Windows.Controls; namespace Samples { /// /// Interaction logic for FancyPopup.xaml /// public partial class FancyPopup : UserControl { #region ClickCount dependency property /// /// The number of clicks on the popup button. /// public static readonly DependencyProperty ClickCountProperty = DependencyProperty.Register("ClickCount", typeof (int), typeof (FancyPopup), new FrameworkPropertyMetadata(0)); /// /// A property wrapper for the /// dependency property:
/// The number of clicks on the popup button. ///
public int ClickCount { get { return (int) GetValue(ClickCountProperty); } set { SetValue(ClickCountProperty, value); } } #endregion public FancyPopup() { InitializeComponent(); } private void OnButtonClick(object sender, RoutedEventArgs e) { //just increment a counter - will be displayed on screen ClickCount++; } } }