SetterAction.cs 642 B

12345678910111213141516171819202122232425262728
  1. using Microsoft.Xaml.Behaviors;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. namespace PDF_Office.Helper
  9. {
  10. public class SetterAction : TriggerAction<DependencyObject>
  11. {
  12. public SetterAction()
  13. {
  14. Setters = new List<Setter>();
  15. }
  16. public List<Setter> Setters { get; set; }
  17. protected override void Invoke(object parameter)
  18. {
  19. foreach (var item in Setters)
  20. {
  21. AssociatedObject.SetValue(item.Property, item.Value);
  22. }
  23. }
  24. }
  25. }