/// <summary>
        /// Returns the object that corresponds to the specified resource key.
        /// </summary>
        /// <param name="serviceProvider">An object that can provide services for the markup extension.</param>
        /// <returns>The object that corresponds to the specified resource key.</returns>
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            IProvideValueTarget service = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;

            if (service != null && service.TargetProperty != null)
            {
                if (_locInstance == null)
                {
                    _locInstance        = LocalizationInstance.fromTargetProperty(service.TargetProperty);
                    _locInstance.Key    = Key;
                    _locInstance.Format = Format;
                }
                if (service.TargetObject is DependencyObject)
                {
                    _locInstance.AddTarget(service.TargetObject as DependencyObject);
                    return(_locInstance.GetValue());
                }
                else
                {
                    //Localization is used in a Template
                    return(this);
                }
            }
            return(null);
        }
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            IProvideValueTarget service = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;
            if (service != null && service.TargetProperty != null)
            {
                var targetObject = service.TargetObject as FrameworkElement;
                if (targetObject != null)
                {
                    _locInstance = LocalizationInstance.fromTargetProperty(service.TargetProperty);
                    _locInstance.AddTarget(targetObject);

                    var bTarget = new LocBindingTarget(_locInstance, targetObject, Path);

                    return _locInstance.GetValue();
                }
                else
                    return this;
            }
            return null;
        }
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            IProvideValueTarget service = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;

            if (service != null && service.TargetProperty != null)
            {
                var targetObject = service.TargetObject as FrameworkElement;
                if (targetObject != null)
                {
                    _locInstance = LocalizationInstance.fromTargetProperty(service.TargetProperty);
                    _locInstance.AddTarget(targetObject);

                    var bTarget = new LocBindingTarget(_locInstance, targetObject, Path);

                    return(_locInstance.GetValue());
                }
                else
                {
                    return(this);
                }
            }
            return(null);
        }