Example #1
0
        private static void ApplyCustomThumbSetting(Thumb thumb)
        {            
            var dragablzItem = thumb.VisualTreeAncestory().OfType<DragablzItem>().FirstOrDefault();
            if (dragablzItem == null) throw new ApplicationException("Cannot find parent DragablzItem for custom thumb");

            System.Diagnostics.Debug.WriteLine("ApplyCustomThumbSetting " + dragablzItem.IsDragging);

            var enableCustomThumb = (bool)thumb.GetValue(IsCustomThumbProperty);
            dragablzItem._customThumb = enableCustomThumb ? thumb : null;
            dragablzItem._templateSubscriptions.Disposable = dragablzItem.SelectAndSubscribeToThumb().Item2;

            if (dragablzItem._customThumb != null && dragablzItem._isTemplateThumbWithMouseAfterSeize)
                dragablzItem.Dispatcher.BeginInvoke(new Action(() => dragablzItem._customThumb.RaiseEvent(new MouseButtonEventArgs(InputManager.Current.PrimaryMouseDevice,
                        0,
                        MouseButton.Left) { RoutedEvent = MouseLeftButtonDownEvent })));
        }