Пример #1
0
        private void SetStyle(Ellipse ellipse, bool isVisible)
        {
            var style = new Style(typeof(Ellipse));

            style.Setters.Add(new Setter(Ellipse.FillProperty, isVisible ? NormalBrush : TransparentBrush));
            style.Setters.Add(new Setter(Ellipse.StrokeProperty, isVisible ? NormalBrush : TransparentBrush));

            var isSelectedTrigger = new Trigger()
            {
                Property = FrameworkElementProperties.IsSelectedProperty, Value = true
            };

            isSelectedTrigger.Setters.Add(new Setter(Ellipse.FillProperty, SelectedBrush));
            isSelectedTrigger.Setters.Add(new Setter(Ellipse.StrokeProperty, SelectedBrush));
            style.Triggers.Add(isSelectedTrigger);

            var isMouseOverTrigger = new Trigger()
            {
                Property = Ellipse.IsMouseOverProperty, Value = true
            };

            isMouseOverTrigger.Setters.Add(new Setter(Ellipse.FillProperty, HoverBrush));
            isMouseOverTrigger.Setters.Add(new Setter(Ellipse.StrokeProperty, HoverBrush));
            style.Triggers.Add(isMouseOverTrigger);

            ellipse.Style = style;

            FrameworkElementProperties.SetIsSelected(ellipse, false);
        }
Пример #2
0
 public bool GetIsSelected(IElement element)
 {
     return(FrameworkElementProperties.GetIsSelected(element.Native as FrameworkElement));
 }
Пример #3
0
 public void SetIsSelected(IElement element, bool value)
 {
     FrameworkElementProperties.SetIsSelected(element.Native as FrameworkElement, value);
 }