Example #1
0
        /// <summary>
        /// when element want to get her value from extension
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <returns></returns>
        public object ProvideValue(IServiceProvider serviceProvider)
        {
            IProvideValueTarget target = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;

            if (target != null)
            {
                Target   = target.TargetObject;
                Property = target.TargetProperty;
            }
            LanguageMapper.AddElement(this);
            return(GetValue(target.TargetProperty.ToString(), LanguageMapper.GetValue(Key)));
        }
Example #2
0
        /// <summary>
        /// when element want to get her value from extension
        /// </summary>
        /// <param name="serviceProvider"></param>
        /// <returns></returns>
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            IProvideValueTarget target = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;

            if (target != null)
            {
                Target   = target.TargetObject;
                Property = target.TargetProperty;
            }
            LanguageMapper.AddElement(this);
            //var prop = (target.TargetProperty as DependencyProperty);
            //var descriptor = DependencyPropertyDescriptor.FromName(prop.Name, Target.GetType(), Target.GetType());

            //var action = new EventHandler((s, e) =>
            //{

            //});
            //descriptor.AddValueChanged(target, action);
            return(GetValue(target.TargetProperty.ToString(), LanguageMapper.GetValue(Key)));
        }