當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。