本文整理汇总了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);
}
示例2: ProvideValue
public override object ProvideValue(IServiceProvider serviceProvider)
{
var binding = new Binding("Value")
{
Source = new TranslationSource(_key)
};
return binding.ProvideValue(serviceProvider);
}
示例3: ProvideValue
public override object ProvideValue(IServiceProvider serviceProvider)
{
var binding = new Binding("SelectedCulture[" + Id + "]")
{
Source = GlobalizationUtilities.TheInstance
};
return binding.ProvideValue(serviceProvider);
}
示例4: ProvideValue
public override object ProvideValue(IServiceProvider serviceProvider)
{
var binding = new Binding("Value")
{
Source = new FontFamilyData { Culture = _culture }
};
return binding.ProvideValue(serviceProvider);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}