private Style InizializzaAnimazioni(Style newStyle) { if (newStyle == null) { newStyle = new Style(); } //***Animazione colore OFF ColorAnimation claColoreStelo = new ColorAnimation(ColoreStelo.Color, TimeSpan.FromSeconds(0.2)); Storyboard.SetTargetProperty(claColoreStelo, new PropertyPath("ColoreStelo.Color")); ColorAnimation claColoreToggle = new ColorAnimation(ColoreToggle.Color, TimeSpan.FromSeconds(0.2)); Storyboard.SetTargetProperty(claColoreToggle, new PropertyPath("ColoreToggle.Color")); ColorAnimation claColoreBordo = new ColorAnimation(ColoreBordo.Color, TimeSpan.FromSeconds(0.2)); Storyboard.SetTargetProperty(claColoreBordo, new PropertyPath("ColoreBordo.Color")); Anim.CreaBloccoAnimazioni(newStyle, new List <Condition> { new Condition(IsCheckedProperty, false), new Condition(IsEnabledProperty, true) }, new List <Timeline> { claColoreStelo, claColoreToggle, claColoreBordo }); //***Animazione colore ON claColoreStelo = new ColorAnimation(ColoreSteloOn.Color, TimeSpan.FromSeconds(0.2)); Storyboard.SetTargetProperty(claColoreStelo, new PropertyPath("ColoreStelo.Color")); claColoreToggle = new ColorAnimation(ColoreToggleOn.Color, TimeSpan.FromSeconds(0.2)); Storyboard.SetTargetProperty(claColoreToggle, new PropertyPath("ColoreToggle.Color")); claColoreBordo = new ColorAnimation(ColoreBordoOn.Color, TimeSpan.FromSeconds(0.2)); Storyboard.SetTargetProperty(claColoreBordo, new PropertyPath("ColoreBordo.Color")); ColorAnimation claColoreTesto = new ColorAnimation(ColoreTestoOn.Color, TimeSpan.FromSeconds(0.2)); Storyboard.SetTargetProperty(claColoreTesto, new PropertyPath("Foreground.Color")); Anim.CreaBloccoAnimazioni(newStyle, new List <Condition> { new Condition(IsCheckedProperty, true), new Condition(IsEnabledProperty, true) }, new List <Timeline> { claColoreStelo, claColoreToggle, claColoreBordo, claColoreTesto }); //***Animazione colore DISABLED claColoreStelo = new ColorAnimation(ColoreSteloDisabled.Color, TimeSpan.FromSeconds(0.1)); Storyboard.SetTargetProperty(claColoreStelo, new PropertyPath("ColoreStelo.Color")); claColoreToggle = new ColorAnimation(ColoreToggleDisabled.Color, TimeSpan.FromSeconds(0.1)); Storyboard.SetTargetProperty(claColoreToggle, new PropertyPath("ColoreToggle.Color")); claColoreBordo = new ColorAnimation(ColoreBordoDisabled.Color, TimeSpan.FromSeconds(0.1)); Storyboard.SetTargetProperty(claColoreBordo, new PropertyPath("ColoreBordo.Color")); claColoreTesto = new ColorAnimation(ColoreTestoDisabled.Color, TimeSpan.FromSeconds(0.1)); Storyboard.SetTargetProperty(claColoreTesto, new PropertyPath("Foreground.Color")); Anim.CreaBloccoAnimazioni(newStyle, new List <Condition> { new Condition(IsEnabledProperty, false) }, new List <Timeline> { claColoreStelo, claColoreToggle, claColoreBordo, claColoreTesto }); //Dim ellips As Ellipse = Me.Template.FindName("llpToggle", Me) //ellips.BeginStoryboard(stbScorri) //this.Style = stile; return(newStyle); }