Ejemplo n.º 1
0
        public static UIElement MakeBulletChrome(object obj)
        {
            var bchrome = new Microsoft.Windows.Themes.BulletChrome();

            bchrome.SetBinding(Microsoft.Windows.Themes.BulletChrome.BorderBrushProperty, new Binding("TemplatedParent.BorderBrush")
            {
                Source = obj
            });
            bchrome.SetBinding(Microsoft.Windows.Themes.BulletChrome.BackgroundProperty, new Binding("TemplatedParent.Background")
            {
                Source = obj
            });
            bchrome.SetBinding(Microsoft.Windows.Themes.BulletChrome.RenderMouseOverProperty, new Binding("TemplatedParent.IsMouseOver")
            {
                Source = obj
            });
            bchrome.SetBinding(Microsoft.Windows.Themes.BulletChrome.RenderPressedProperty, new Binding("TemplatedParent.IsPressed")
            {
                Source = obj
            });
            bchrome.SetBinding(Microsoft.Windows.Themes.BulletChrome.IsCheckedProperty, new Binding("TemplatedParent.IsChecked")
            {
                Source = obj
            });
            return(bchrome);
        }
        private void DetachBulletChrome(Microsoft.Windows.Themes.BulletChrome bulletChrome)
        {
            if (bulletChrome == null)
            {
                throw new ArgumentNullException("bulletChrome");
            }

            bulletChrome.MouseDown -= BulletChrome_MouseDown;
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            this.BulletChrome = this.GetTemplateChild("PART_BulletChrome") as Microsoft.Windows.Themes.BulletChrome;
        }