当前位置: 首页>>代码示例>>C#>>正文


C# Binding.ProvideValue方法代码示例

本文整理汇总了C#中System.Windows.Data.Binding.ProvideValue方法的典型用法代码示例。如果您正苦于以下问题:C# Binding.ProvideValue方法的具体用法?C# Binding.ProvideValue怎么用?C# Binding.ProvideValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Data.Binding的用法示例。


在下文中一共展示了Binding.ProvideValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProvideValue

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var pvt = serviceProvider as IProvideValueTarget;
            if (pvt == null)
            {
                return null;
            }

            _frameworkElement = pvt.TargetObject as FrameworkElement;
            if (_frameworkElement == null)
            {
                return this;
            }

            _target = pvt.TargetProperty as DependencyProperty;
            if (_target == null)
            {
                return this;
            }

            _frameworkElement.DataContextChanged += FrameworkElement_DataContextChanged;

            var proxy = new Proxy();
            var binding = new Binding()
            {
                Source = proxy,
                Path = new PropertyPath("Value")
            };

            // Make sure we don't leak subscriptions
            _frameworkElement.Unloaded += (e, v) => _subscription.Dispose();

            return binding.ProvideValue(serviceProvider);
        }
开发者ID:Evangelink,项目名称:WPF-Rethought,代码行数:34,代码来源:ReactiveBinding.cs

示例2: ProvideValue

 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     var binding = new Binding("Value")
                       {
                           Source = new TranslationSource(_key)
                       };
     return binding.ProvideValue(serviceProvider);
 }
开发者ID:NomadPL,项目名称:Nomad,代码行数:8,代码来源:ResourceExtension.cs

示例3: ProvideValue

 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     var binding = new Binding("SelectedCulture[" + Id + "]")
     {
         Source = GlobalizationUtilities.TheInstance
     };
     return binding.ProvideValue(serviceProvider);
 }
开发者ID:Slesa,项目名称:Poseidon,代码行数:8,代码来源:CultureResourceExtension.cs

示例4: ProvideValue

 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     var binding = new Binding("Value")
     {
         Source = new FontFamilyData { Culture = _culture }
     };
     return binding.ProvideValue(serviceProvider);
 }
开发者ID:rabbicse,项目名称:WPF-SBMS,代码行数:8,代码来源:FontFamilyExtension.cs

示例5: ProvideValue

        public override object ProvideValue(IServiceProvider rpServiceProvider)
        {
            var rBinding = new Binding(r_Path) { Source = Preference.Current, Mode = BindingMode.TwoWay, Converter = Converter, ConverterParameter = ConverterParameter, UpdateSourceTrigger = UpdateSourceTrigger };
            if (ValidationRule != null)
                rBinding.ValidationRules.Add(ValidationRule);

            return rBinding.ProvideValue(rpServiceProvider);
        }
开发者ID:CodeForCSharp,项目名称:KanColleInspector,代码行数:8,代码来源:PreferenceExtension.cs

示例6: ProvideValue

    public override object ProvideValue(IServiceProvider serviceProvider)
    {
      if (IsDesignMode)
        return Key;

      var binding = new Binding("Value") {Source = new LocalizationData(_key)};
      return binding.ProvideValue(serviceProvider);
    }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:8,代码来源:LocExtension.cs

示例7: ProvideValue

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            Binding bind = new Binding("Value");
            bind.Path=new PropertyPath(Value);
            bind.Mode=BindingMode.TwoWay;
            bind.Source = vm;

            return bind.ProvideValue(serviceProvider);
        }
开发者ID:wangjianglin,项目名称:dotnet-core,代码行数:9,代码来源:AndConvert.cs

示例8: ProvideValue

 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     var binding = new Binding("Value")
           {
               Source = new TranslationBinding(_key, _default),
               Mode = BindingMode.OneWay
           };
     return binding.ProvideValue(serviceProvider);
 }
开发者ID:Jonas-Jancarik,项目名称:articulate,代码行数:9,代码来源:TranslateExtension.cs

示例9: ProvideValue

		public override object ProvideValue(IServiceProvider serviceProvider)
		{
			if (UpdateOnLanguageChange) {
				Binding binding = new Binding("Value") { Source = this, Mode = BindingMode.OneWay };
				return binding.ProvideValue(serviceProvider);
			} else {
				return this.Value;
			}
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:9,代码来源:LocalizeExtension.cs

示例10: ProvideValue

 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     var counter = new Counter();
     var binding = new Binding(nameof(counter.Value))
     {
         Source = counter,
         Mode = BindingMode.OneWay,
         UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
     };
     return binding.ProvideValue(serviceProvider);
 }
开发者ID:JohanLarsson,项目名称:MarkupExtensionBox,代码行数:11,代码来源:CounterExtension.cs

示例11: ProvideValue

        public override object ProvideValue(IServiceProvider rpServiceProvider)
        {
            if (DesignerProperties.GetIsInDesignMode(r_DesignModeDetector))
                return DependencyProperty.UnsetValue;

            var rBinding = new Binding(r_Path) { Source = Preference.Instance, Mode = BindingMode.TwoWay, Converter = Converter, ConverterParameter = ConverterParameter, UpdateSourceTrigger = UpdateSourceTrigger, StringFormat = StringFormat };
            if (ValidationRule != null)
                rBinding.ValidationRules.Add(ValidationRule);

            return rBinding.ProvideValue(rpServiceProvider);
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun,代码行数:11,代码来源:PreferenceExtension.cs

示例12: ProvideValue

 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     var instance = DesignTimeValue.Instance;
     var binding = new Binding(nameof(instance.CurrentValue))
     {
         Source = instance,
         Mode = BindingMode.OneWay,
         UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
     };
     return binding.ProvideValue(serviceProvider);
 }
开发者ID:JohanLarsson,项目名称:MarkupExtensionBox,代码行数:11,代码来源:DesignTimeExtension.cs

示例13: ProvideValue

        /// <inheritdoc />
        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var binding = new Binding()
            {
                Source = EffectiveCultureProxy.Instance,
                Path = ValuePath,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
                Mode = BindingMode.OneWay,
                Converter = CultureToXmlLanguageConverter.Default
            };

            return binding.ProvideValue(serviceProvider);
        }
开发者ID:csuffyy,项目名称:Gu.Localization,代码行数:14,代码来源:EffectiveXmlLanguageExtension.cs

示例14: ProvideValue

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            var rootObjectProvider = (IRootObjectProvider) serviceProvider.GetService(typeof (IRootObjectProvider));
            var binding = new Binding
            {
                Path = DataContextPath,
                Source = rootObjectProvider?.RootObject,
                Mode = BindingMode.OneWay,
                UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
            };

            return binding.ProvideValue(serviceProvider);
        }
开发者ID:JohanLarsson,项目名称:RemoveItemBox,代码行数:13,代码来源:RootObjectDataContext.cs

示例15: ProvideValue

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            IProvideValueTarget target = serviceProvider.GetService(typeof(IProvideValueTarget)) as IProvideValueTarget;

            if (target.TargetObject is Setter)
            {
                return new Binding(Path) { Converter = ImgaeResourceConverter.Default };
            }
            else
            {
                Binding binding = new Binding(Path) { Converter = ImgaeResourceConverter.Default };
                return binding.ProvideValue(serviceProvider);
            }
        }
开发者ID:kasicass,项目名称:kasicass,代码行数:14,代码来源:ImageResourceExtension.cs


注:本文中的System.Windows.Data.Binding.ProvideValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。