本文整理汇总了C#中System.Windows.PropertyPath类的典型用法代码示例。如果您正苦于以下问题:C# PropertyPath类的具体用法?C# PropertyPath怎么用?C# PropertyPath使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PropertyPath类属于System.Windows命名空间,在下文中一共展示了PropertyPath类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: AddDouble
///
/// <summary>
/// Helper to create double animation</summary>
///
public static Storyboard AddDouble(
this Storyboard sb,
int durationMs,
DependencyObject element,
PropertyPath path,
double from,
double to,
IEasingFunction easing = null
)
{
DoubleAnimation da;
da = new DoubleAnimation();
da.Duration = new Duration(TimeSpan.FromMilliseconds(durationMs));
da.From = from;
da.To = to;
if (easing != null)
{
da.EasingFunction = easing;
}
Storyboard.SetTarget(da, element);
Storyboard.SetTargetProperty(da, path);
sb.Children.Add(da);
return sb;
}
开发者ID:TrakHound,项目名称:TrakHound-Community,代码行数:33,代码来源:Utilities.cs
示例2: PropertyPathCtors
public void PropertyPathCtors ()
{
PropertyPath prop;
Assert.Throws <ArgumentOutOfRangeException>(() =>
prop = new PropertyPath ("first", "second")
, "#1");
Assert.Throws<ArgumentOutOfRangeException>(delegate {
prop = new PropertyPath (null, "arg1");
}, "null path throws ArgumentOutOfRangeException");
prop = new PropertyPath (Rectangle.WidthProperty);
Assert.AreEqual ("(0)", prop.Path, "Normal PropertyPath");
prop = new PropertyPath (Canvas.LeftProperty);
Assert.AreEqual ("(0)", prop.Path, "Attached PropertyPath");
prop = new PropertyPath (5);
Assert.IsNull (prop.Path, "numeric PropertyPath is null");
Assert.Throws<NullReferenceException> (delegate {
prop = new PropertyPath (null, null);
}, "Both null");
Assert.Throws<NullReferenceException> (delegate {
prop = new PropertyPath ("pathstring", null);
}, "second null");
prop = new PropertyPath ((string) null);
Assert.IsNull (prop.Path, "null PropertyPath is null");
}
开发者ID:dfr0,项目名称:moon,代码行数:32,代码来源:PropertyPathTest.cs
示例3: SmoothSetAsync
public static Task SmoothSetAsync(this FrameworkElement @this, DependencyProperty dp, double targetvalue,
TimeSpan iDuration, CancellationToken iCancellationToken)
{
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
DoubleAnimation anim = new DoubleAnimation(targetvalue, new Duration(iDuration));
PropertyPath p = new PropertyPath("(0)", dp);
Storyboard.SetTargetProperty(anim, p);
Storyboard sb = new Storyboard();
sb.Children.Add(anim);
EventHandler handler = null;
handler = delegate
{
sb.Completed -= handler;
sb.Remove(@this);
@this.SetValue(dp, targetvalue);
tcs.TrySetResult(null);
};
sb.Completed += handler;
sb.Begin(@this, true);
iCancellationToken.Register(() =>
{
double v = (double)@this.GetValue(dp);
sb.Stop();
sb.Remove(@this);
@this.SetValue(dp, v);
tcs.TrySetCanceled();
});
return tcs.Task;
}
开发者ID:David-Desmaisons,项目名称:MusicCollection,代码行数:31,代码来源:FrameworkElementExtender.cs
示例4: GetTypeFromName
private static Type GetTypeFromName (PropertyPath propertyPath, string name)
{
// HACK
return (Type)typeof(PropertyPath)
.GetMethod("GetTypeFromName", BindingFlags.Instance | BindingFlags.NonPublic)
.Invoke(propertyPath, new object[] { name, null });
}
开发者ID:binki,项目名称:Alba.Framework,代码行数:7,代码来源:AncestorBinding.cs
示例5: CreateAnim
public static Storyboard CreateAnim(DependencyObject target, EquationType type, TimeSpan duration, PropertyPath property, double from, double to)
{
Storyboard sb = new Storyboard();
AddAnimation(sb, target, property, duration, type, from, to);
return sb;
}
开发者ID:Titaye,项目名称:SLExtensions,代码行数:8,代码来源:Tween.cs
示例6: AnimationInfo
public AnimationInfo(DependencyObject target, PropertyPath propertyPath, double startValue, double endValue, IEasingFunction easingFunction = null)
{
Target = target;
PropertyPath = propertyPath;
StartValue = startValue;
EndValue = endValue;
EasingFunction = easingFunction;
}
开发者ID:valentinkip,项目名称:Test,代码行数:8,代码来源:UIManager.cs
示例7: CanCreateCommand
public virtual Boolean CanCreateCommand( PropertyPath path, DependencyObject target )
{
if ( DesignTimeHelper.GetIsInDesignMode() )
{
return false;
}
return path != null && ( target is FrameworkElement || target is FrameworkContentElement );
}
开发者ID:micdenny,项目名称:Radical.Windows,代码行数:9,代码来源:DelegateCommandBuilder.cs
示例8: GetPath
internal static PropertyPath GetPath(DependencyProperty property)
{
PropertyPath path;
if (!PropertyPaths.TryGetValue(property, out path))
{
path = new PropertyPath(property);
PropertyPaths[property] = path;
}
return path;
}
开发者ID:gitter-badger,项目名称:Gu.Wpf.DataGrid2D,代码行数:10,代码来源:Helpers.cs
示例9: GetPath
internal static PropertyPath GetPath(string path)
{
PropertyPath propertyPath;
if (!PropertyPaths.TryGetValue(path, out propertyPath))
{
propertyPath = new PropertyPath(path);
PropertyPaths[path] = propertyPath;
}
return propertyPath;
}
开发者ID:punker76,项目名称:Gu.Wpf.ToolTips,代码行数:10,代码来源:BindingHelper.cs
示例10: GetPath
internal static PropertyPath GetPath(int index)
{
PropertyPath path;
if (!IndexPaths.TryGetValue(index, out path))
{
path = new PropertyPath($"[{index}]");
IndexPaths[index] = path;
}
return path;
}
开发者ID:barnstws,项目名称:Gu.Wpf.DataGrid2D,代码行数:11,代码来源:BindingHelper.cs
示例11: PrepareXmlBinding
PropertyPath PrepareXmlBinding(PropertyPath path)
{
if (path == null)
{
DependencyProperty targetDP = TargetProperty;
Type targetType = targetDP.PropertyType;
string pathString;
if (targetType == typeof(Object))
{
if (targetDP == System.Windows.Data.BindingExpression.NoTargetProperty ||
targetDP == System.Windows.Controls.Primitives.Selector.SelectedValueProperty ||
targetDP.OwnerType == typeof(LiveShapingList)
)
{
// these properties want the "value" - i.e. the text of
// the first (and usually only) XmlNode
pathString = "/InnerText";
}
else if (targetDP == FrameworkElement.DataContextProperty ||
targetDP == CollectionViewSource.SourceProperty)
{
// these properties want the entire collection
pathString = String.Empty;
}
else
{
// most object-valued properties want the (current) XmlNode itself
pathString = "/";
}
}
else if (targetType.IsAssignableFrom(typeof(XmlDataCollection)))
{
// these properties want the entire collection
pathString = String.Empty;
}
else
{
// most other properties want the "value"
pathString = "/InnerText";
}
path = new PropertyPath(pathString);
}
// don't bother to create XmlWorker if we don't even have a valid path
if (path.SVI.Length > 0)
{
// tell Xml Worker if desired result is collection, in order to get optimization
SetValue(Feature.XmlWorker, new XmlBindingWorker(this, path.SVI[0].drillIn == DrillIn.Never));
}
return path;
}
开发者ID:JianwenSun,项目名称:cc,代码行数:53,代码来源:CLRBindingWorker.cs
示例12: LocBindingTarget
public LocBindingTarget(LocalizationInstance loc, FrameworkElement targetObject, PropertyPath path)
{
_locInstance = loc;
_lbCollection.Add(this);
_path = path;
targetObject.DataContextChanged += new DependencyPropertyChangedEventHandler(update_binding);
update_binding(targetObject, new DependencyPropertyChangedEventArgs(FrameworkElement.DataContextProperty, null, targetObject.DataContext));
}
开发者ID:rollingthunder,项目名称:Diversity-Synchronization,代码行数:12,代码来源:LocBindingTarget.cs
示例13: SetName
public void SetName ()
{
Storyboard sb = new Storyboard ();
PropertyPath path = new PropertyPath ("Width");
Storyboard.SetTargetProperty (sb, path);
PropertyPath native = Storyboard.GetTargetProperty (sb);
Assert.AreNotEqual (path, native, "#1");
Assert.IsFalse (path == native, "#2");
Assert.AreEqual(path.Path, native.Path, "#3");
Assert.AreEqual (path.Path, "Width", "#4");
}
开发者ID:dfr0,项目名称:moon,代码行数:12,代码来源:PropertyPathTest.cs
示例14: GetPath
private static PropertyPath GetPath(DependencyProperty property)
{
PropertyPath path;
if (PropertyPaths.TryGetValue(property, out path))
{
return path;
}
path = new PropertyPath(property);
PropertyPaths[property] = path;
return path;
}
开发者ID:JohanLarsson,项目名称:Gu.Wpf.Adorners,代码行数:12,代码来源:BindingHelper.cs
示例15: PropertyPathWorker
private PropertyPathWorker(PropertyPath path, DataBindEngine engine)
{
_parent = path;
_arySVS = new SourceValueState[path.Length];
_engine = engine;
// initialize each level to NullDataItem, so that the first real
// item will force a change
for (int i=_arySVS.Length-1; i>=0; --i)
{
_arySVS[i].item = BindingExpression.CreateReference(BindingExpression.NullDataItem);
}
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:13,代码来源:PropertyPathWorker.cs
示例16: PropertyChangeNotifier
public PropertyChangeNotifier(DependencyObject propertySource, PropertyPath property)
{
if (null == propertySource)
throw new ArgumentNullException("propertySource");
if (null == property)
throw new ArgumentNullException("property");
this._propertySource = new WeakReference(propertySource);
Binding binding = new Binding();
binding.Path = property;
binding.Mode = BindingMode.OneWay;
binding.Source = propertySource;
BindingOperations.SetBinding(this, ValueProperty, binding);
}
开发者ID:hinst,项目名称:MyCSharp,代码行数:13,代码来源:PropertyChangeNotifier.cs
示例17: Fade
/// <summary>
/// Animates property of a given object over time
/// </summary>
/// <param name="sender">Object that will be animated</param>
/// <param name="value">Value of the property</param>
/// <param name="milliseconds">Timespan of animation</param>
/// <param name="property">Targeted property</param>
public static void Fade(DependencyObject sender, double value, double milliseconds, PropertyPath property)
{
Storyboard s = new Storyboard();
DoubleAnimation da = new DoubleAnimation();
da.To = value;
da.Duration = new Duration(TimeSpan.FromMilliseconds(milliseconds));
Storyboard.SetTarget(da, sender);
Storyboard.SetTargetProperty(da, property);
s.Children.Add(da);
s.Begin();
}
开发者ID:TVZmc2,项目名称:ErasmusWP,代码行数:20,代码来源:AnimationHelper.cs
示例18: CreateDoubleAnimation
public static DoubleAnimation CreateDoubleAnimation(UIElement uiElement, double from, double to, PropertyPath propertyToAnimate)
{
DoubleAnimation animation = new DoubleAnimation();
Storyboard.SetTarget(animation, uiElement);
Storyboard.SetTargetProperty(animation, propertyToAnimate);
// Note that the animation applies to the Canvas.Left property
animation.From = from ;
animation.To = to ;
animation.Duration = TimeSpan.FromMilliseconds(100);
return animation;
}
开发者ID:MarkPThomas,项目名称:HeadFirst-CSharp,代码行数:14,代码来源:InvadersHelper.cs
示例19: Bind
internal static BindingExpression Bind(
DependencyObject target,
DependencyProperty targetProperty,
object source,
PropertyPath path)
{
var binding = new Binding
{
Path = path,
Source = source,
Mode = BindingMode.OneWay,
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
};
return (BindingExpression)BindingOperations.SetBinding(target, targetProperty, binding);
}
开发者ID:barnstws,项目名称:Gu.Wpf.DataGrid2D,代码行数:15,代码来源:BindingHelper.cs
示例20: MarkupExtension
/// <summary>
/// Initializes a new instance of the <see cref="MarkupExtension"/> class.
/// </summary>
protected MarkupExtension()
{
if (CatelEnvironment.IsInDesignMode)
{
return;
}
Source = this;
Mode = BindingMode.OneWay;
Path = new PropertyPath("InternalBindingValue");
#if NETFX_CORE
Dispatcher.BeginInvoke(UpdateBinding);
#endif
}
开发者ID:jensweller,项目名称:Catel,代码行数:18,代码来源:MarkupExtension.cs
注:本文中的System.Windows.PropertyPath类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论