本文整理汇总了C#中System.ComponentModel.PropertyChangingEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# PropertyChangingEventArgs类的具体用法?C# PropertyChangingEventArgs怎么用?C# PropertyChangingEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertyChangingEventArgs类属于System.ComponentModel命名空间,在下文中一共展示了PropertyChangingEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _location_PropertyChanging
public void _location_PropertyChanging(object sender, PropertyChangingEventArgs e)
{
//if (e.PropertyName == "StadiumName")
//{
// if (((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsLetter))
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
// }
// else
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
// throw new Exception("StadiumName should not have numbers");
// }
//}
if (e.PropertyName == "LocationName")
{
if (((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsLetter))
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
}
else
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
throw new Exception("LocationName should not have numbers");
}
}
}
示例2: RaisePropertyChanging
protected virtual void RaisePropertyChanging(PropertyChangingEventArgs property)
{
if (this.PropertyChanging != null)
{
this.PropertyChanging(this, property);
}
}
示例3: CPropertyChanging
static void CPropertyChanging(Object sender, PropertyChangingEventArgs e)
{
if ("Nome|Sobrenome".Contains(e.PropertyName))
Console.WriteLine("o valor original da propriedade {0} é {1}",
e.PropertyName,
sender.GetType().GetProperty(e.PropertyName).GetValue(sender, null));
}
示例4: OnPropertyChanging
/// <summary>
/// Raises the PropertyChanging event.
/// </summary>
/// <param name="propertyName">The name of the property.</param>
protected virtual void OnPropertyChanging([CallerMemberName] string propertyName = "")
{
if (PropertyChanging != null && SuppressEvents == false)
{
PropertyChangingEventArgs args = new PropertyChangingEventArgs(propertyName);
PropertyChanging(this, args);
}
}
示例5: NotifyPropertyChanging
protected virtual void NotifyPropertyChanging(string propertyName)
{
if (this.PropertyChanging != null)
{
var e = new PropertyChangingEventArgs(propertyName);
this.PropertyChanging(this, e);
}
}
示例6: Preset
public void Preset(object sender, PropertyChangingEventArgs args)
{
if (!_resetOnce)
return;
var stones = ((CupVM)DataContext).Stones;
tbStones.ClearValue(TextBlock.TextProperty);
tbStones.Text = stones.ToString();
_resetOnce = false;
}
示例7: RememberOldValue
public void RememberOldValue(object sender, PropertyChangingEventArgs e)
{
if(instance != null)
{
throw new InvalidOperationException("Old value is already initialized");
}
instance = sender;
propertyName = e.PropertyName;
oldValue = TypeUtils.GetPropertyValue(sender, e.PropertyName);
}
示例8: RaisePropertyChangingEvent
/// <summary>
/// elevar el evento de PropertyChanging. La propiedad especificada va a ser cambiada.
/// </summary>
/// <param name="propertyName">El nombre de la propiedad que ha cambiado.</param>
public virtual void RaisePropertyChangingEvent(string propertyName)
{
// Salir si los cambios son ignorados.
if (IgnorePropertyChangeEvents) return;
// Salir si no se suscriben
if (PropertyChanging == null) return;
// Elevar el evento
var e = new PropertyChangingEventArgs(propertyName);
PropertyChanging(this, e);
}
示例9: MyPropertyChanging
private void MyPropertyChanging(object sender, PropertyChangingEventArgs e)
{
lock (this.oldPropertyValueDic)
{
// ViewModelの状態を元すため、プロパティの元の値を保存します。
if (!this.oldPropertyValueDic.ContainsKey(e.PropertyName))
{
this.oldPropertyValueDic[e.PropertyName] =
MethodUtil.GetPropertyValue(sender, e.PropertyName);
}
}
base.OnPropertyChanging(e);
}
示例10: OnLocationPropertyChanging
protected void OnLocationPropertyChanging(object sender, PropertyChangingEventArgs e)
{
LocationObj loc = sender as LocationObj;
if (loc == null)
return;
// Trace.WriteLine("Location property changing: " + loc.ToString() + " property: " + e.PropertyName);
//Update if a position or everything has changed
if (e.PropertyName.Contains("Position") || e.PropertyName.Contains("WorldPosition") || string.IsNullOrEmpty(e.PropertyName))
{
// Location locView = new Location(loc);
RemoveStructureLinks(new LocationObj[]{loc});
RemoveLocations(new LocationObj[] { loc }, false);
}
}
示例11: _team_PropertyChanging
public void _team_PropertyChanging(object sender, PropertyChangingEventArgs e)
{
if (e.PropertyName == "ShortName")
{
if(((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsLetter))
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
}
else
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
throw new Exception("Short Name should not have numbers");
}
}
}
示例12: _player_PropertyChanging
public void _player_PropertyChanging(object sender, PropertyChangingEventArgs e)
{
//if (e.PropertyName == "FirstName")
//{
// if (((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsLetter))
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
// }
// else
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
// throw new Exception("First Name should contain only Characters");
// }
//}
//else if (e.PropertyName == "LastName")
//{
// if (((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsLetter))
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
// }
// else
// {
// ((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
// throw new Exception("Last Name should contain only Characters");
// }
//}
if (e.PropertyName == "MobileNo")
{
if (((PropertyChangingCancelEventArgs<String>)e).NewValue.All(char.IsDigit))
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = false;
}
else
{
((PropertyChangingCancelEventArgs<String>)e).Cancel = true;
throw new Exception("Mobile No should contain only Numbers");
}
}
}
示例13: OnPropertyChanging
private void OnPropertyChanging(object subject, PropertyChangingEventArgs args)
{
if (args.PropertyName == PropertyName)
{
log.Trace("OnPropertyChanging " + args.PropertyName);
// Unsubscribe from children
UnsubscribeFromChildren(subject);
}
}
示例14: OnPropertyChanging
private void OnPropertyChanging(object sender, PropertyChangingEventArgs e)
{
switch (e.PropertyName)
{
case "SelectedView":
CheckSettingsWorkspace(SelectedView);
break;
}
}
示例15: InstancePropertyChanging
private static void InstancePropertyChanging(object sender, PropertyChangingEventArgs e)
{
}