public override IDataTriggerCondition CreateDataTriggerCondition(FrameworkElement element) { if (Property == null) { throw new Granular.Exception("Trigger.Property cannot be null"); } DependencyProperty dependencyProperty = Property.GetDependencyProperty(element.GetType()); object resolvedValue = Value == null || dependencyProperty.PropertyType.IsInstanceOfType(Value) ? Value : TypeConverter.ConvertValue(Value.ToString(), dependencyProperty.PropertyType, XamlNamespaces.Empty, null); FrameworkElement source = SourceName.IsNullOrEmpty() ? element : NameScope.GetTemplateNameScope(element).FindName(SourceName) as FrameworkElement; return(TriggerCondition.Register(source, dependencyProperty, resolvedValue)); }
private void StartNewStoryboard(Storyboard newStoryboard) { if (newStoryboard != null) { newStoryboard.Begin(container, NameScope.GetTemplateNameScope(container)); if (currentStoryboard != null) { currentStoryboard.Stop(container); } } else if (currentStoryboard != null) { currentStoryboard.Remove(container); } currentStoryboard = newStoryboard; }
private static FrameworkElement GetResolvedTarget(FrameworkElement target, string targetName, BaseValueSource valueSource) { return(targetName.IsNullOrEmpty() ? target : (valueSource == BaseValueSource.Local ? NameScope.GetContainingNameScope(target) : NameScope.GetTemplateNameScope(target)).FindName(targetName) as FrameworkElement); }