Example #1
0
        /// <summary>
        /// Handle the Loaded event of the element to which this view model is attached
        /// in order to enable the attached
        /// view model to bind to properties of the parent element
        /// </summary>
        private static void HandleElementLoaded(object sender, RoutedEventArgs e)
        {
            FrameworkElement             targetElement = sender as FrameworkElement;
            CircularProgressBarViewModel attachedModel = GetAttach(targetElement);

            // find the ProgressBar and associated it with the view model
            var progressBar = targetElement.Ancestors <ProgressBar>().Single() as ProgressBar;

            attachedModel.SetProgressBar(progressBar);
        }
Example #2
0
 public static void SetAttach(DependencyObject d, CircularProgressBarViewModel value)
 {
     d.SetValue(AttachProperty, value);
 }