public override object ProvideValue(IServiceProvider serviceProvider) { var collection = new VisualStateGroupCollection(); collection.AddRange(VisualGroups.EnumerateGroups(Groups)); return(collection); }
private bool HasStateGroup(FrameworkElement element) { if (element != null) { VisualStateGroupCollection groups = VisualStateManager.GetVisualStateGroups(element); return(groups != null && groups.Count > 0); } else { return(false); } }
/// <summary> /// Assign a <see cref="VisualStateGroupCollection" /> of visual states groups to specified bindable. /// </summary> /// <param name="bindable">Target bindable.</param> /// <param name="value"><see cref="VisualStateGroup" /> collection, should be assigned to <paramref name="bindable" />.</param> public static void SetVisualStateGroups(BindableObject bindable, VisualStateGroupCollection value) { bindable.SetValue(VisualStateGroupsProperty, value); }