本文整理汇总了C#中PerspexPropertyChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# PerspexPropertyChangedEventArgs类的具体用法?C# PerspexPropertyChangedEventArgs怎么用?C# PerspexPropertyChangedEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PerspexPropertyChangedEventArgs类属于命名空间,在下文中一共展示了PerspexPropertyChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPerspexProperty_valueChanged
/// <summary>
/// Handle when dependency property value changes to update the underline HtmlContainer with the new value.
/// </summary>
private static void OnPerspexProperty_valueChanged(PerspexObject PerspexObject, PerspexPropertyChangedEventArgs e)
{
var control = PerspexObject as HtmlLabel;
if (control != null)
{
if (e.Property == AutoSizeProperty)
{
if ((bool)e.NewValue)
{
PerspexObject.SetValue(AutoSizeHeightOnlyProperty, false);
control.InvalidateMeasure();
control.InvalidateVisual();
}
}
else if (e.Property == AutoSizeHeightOnlyProperty)
{
if ((bool)e.NewValue)
{
PerspexObject.SetValue(AutoSizeProperty, false);
control.InvalidateMeasure();
control.InvalidateVisual();
}
}
}
}
示例2: AdornedElementChanged
private static void AdornedElementChanged(PerspexPropertyChangedEventArgs e)
{
var adorner = (Visual)e.Sender;
var adorned = (Visual)e.NewValue;
var layer = adorner.GetVisualParent<AdornerLayer>();
layer?.UpdateAdornedElement(adorner, adorned);
}
示例3: ValueChanged
private void ValueChanged(PerspexPropertyChangedEventArgs e)
{
if (_indicator != null)
{
double percent = Maximum == Minimum ? 1.0 : ((double)e.NewValue - Minimum) / (Maximum - Minimum);
_indicator.Width = Bounds.Width * percent;
}
}
示例4: ValueChanged
private void ValueChanged(PerspexPropertyChangedEventArgs e)
{
if (this.indicator != null)
{
double percent = this.Maximum == this.Minimum ? 1.0 : ((double)e.NewValue - this.Minimum) / (this.Maximum - this.Minimum);
this.indicator.Width = this.Bounds.Width * percent;
}
}
示例5: IsSelectedChanged
/// <summary>
/// Called when the <see cref="IsSelected"/> property changes on an object.
/// </summary>
/// <param name="e">The sender.</param>
private static void IsSelectedChanged(PerspexPropertyChangedEventArgs e)
{
var interactive = e.Sender as IInteractive;
if (interactive != null)
{
interactive.RaiseEvent(new RoutedEventArgs(SelectingItemsControl.IsSelectedChangedEvent));
}
}
示例6: SelectedIndexChanged
/// <summary>
/// Called when the <see cref="SelectingItemsControl.SelectedIndex"/> property changes.
/// </summary>
/// <param name="e">The event args.</param>
private void SelectedIndexChanged(PerspexPropertyChangedEventArgs e)
{
if ((int)e.NewValue != -1)
{
var item = SelectedItem as IContentControl;
var content = item?.Content ?? item;
SelectedTab = item as TabItem;
}
}
示例7: OnPropertyChanged
/// <summary>
/// Reacts to a change in a <see cref="PerspexProperty"/> value in order to animate the
/// change if a <see cref="PropertyTransition"/> is set for the property..
/// </summary>
/// <param name="e">The event args.</param>
protected override void OnPropertyChanged(PerspexPropertyChangedEventArgs e)
{
if (e.Priority != BindingPriority.Animation && _propertyTransitions != null)
{
var match = _propertyTransitions.FirstOrDefault(x => x.Property == e.Property);
if (match != null)
{
Animate.Property(this, e.Property, e.OldValue, e.NewValue, match.Easing, match.Duration);
}
}
}
示例8: ContextMenuChanged
/// <summary>
/// called when the <see cref="ContextMenuProperty"/> property changes on a control.
/// </summary>
/// <param name="e">The event args.</param>
private static void ContextMenuChanged(PerspexPropertyChangedEventArgs e)
{
var control = (Control)e.Sender;
if (e.OldValue != null)
{
control.PointerReleased -= ControlPointerReleased;
}
if (e.NewValue != null)
{
control.PointerReleased += ControlPointerReleased;
}
}
示例9: TipChanged
/// <summary>
/// called when the <see cref="TipProperty"/> property changes on a control.
/// </summary>
/// <param name="e">The event args.</param>
private static void TipChanged(PerspexPropertyChangedEventArgs e)
{
var control = (Control)e.Sender;
if (e.OldValue != null)
{
control.PointerEnter -= ControlPointerEnter;
control.PointerLeave -= ControlPointerLeave;
}
if (e.NewValue != null)
{
control.PointerEnter += ControlPointerEnter;
control.PointerLeave += ControlPointerLeave;
}
}
示例10: OnIsExpandedChanged
protected virtual void OnIsExpandedChanged(PerspexPropertyChangedEventArgs e)
{
IVisual visualContent = Presenter;
if (Content != null && ContentTransition != null && visualContent != null)
{
bool forward = ExpandDirection == ExpandDirection.Left ||
ExpandDirection == ExpandDirection.Up;
if (IsExpanded)
{
ContentTransition.Start(null, visualContent, forward);
}
else
{
ContentTransition.Start(visualContent, null, !forward);
}
}
}
示例11: ChildChanged
/// <summary>
/// Called when the <see cref="Child"/> property changes.
/// </summary>
/// <param name="e">The event args.</param>
private void ChildChanged(PerspexPropertyChangedEventArgs e)
{
var oldChild = (Control)e.OldValue;
var newChild = (Control)e.NewValue;
if (oldChild != null)
{
((ISetLogicalParent)oldChild).SetParent(null);
LogicalChildren.Clear();
RemoveVisualChild(oldChild);
}
if (newChild != null)
{
AddVisualChild(newChild);
LogicalChildren.Add(newChild);
((ISetLogicalParent)newChild).SetParent(this);
}
}
示例12: ItemsChanged
private static void ItemsChanged(PerspexPropertyChangedEventArgs e)
{
var grid = (Grid)e.Sender;
var items = (IEnumerable)e.NewValue;
var template = grid.GetValue(TemplateProperty);
grid.Children.Clear();
if (items != null)
{
int count = 0;
int cols = grid.ColumnDefinitions.Count;
foreach (var item in items)
{
foreach (var control in template(item))
{
grid.Children.Add(control);
Grid.SetColumn(control, count % cols);
Grid.SetRow(control, count / cols);
++count;
}
}
int rows = (int)Math.Ceiling((double)count / cols);
int difference = rows - grid.RowDefinitions.Count;
if (difference > 0)
{
for (int i = 0; i < difference; ++i)
{
grid.RowDefinitions.Add(new RowDefinition(GridLength.Auto));
}
}
else if (difference < 0)
{
for (int i = 0; i < difference; ++i)
{
grid.RowDefinitions.RemoveAt(grid.RowDefinitions.Count - 1);
}
}
}
}
示例13: IsDefaultChanged
/// <summary>
/// Called when the <see cref="IsDefault"/> property changes.
/// </summary>
/// <param name="e">The event args.</param>
private static void IsDefaultChanged(PerspexPropertyChangedEventArgs e)
{
var button = e.Sender as Button;
var isDefault = (bool)e.NewValue;
var root = button.GetSelfAndVisualAncestors().OfType<IRenderRoot>().FirstOrDefault();
var inputElement = root as IInputElement;
if (inputElement != null)
{
if (isDefault)
{
button.ListenForDefault(inputElement);
}
else
{
button.StopListeningForDefault(inputElement);
}
}
}
示例14: CommandChanged
/// <summary>
/// Called when the <see cref="Command"/> property changes.
/// </summary>
/// <param name="e">The event args.</param>
private static void CommandChanged(PerspexPropertyChangedEventArgs e)
{
var button = e.Sender as Button;
if (button != null)
{
var oldCommand = e.OldValue as ICommand;
var newCommand = e.NewValue as ICommand;
if (oldCommand != null)
{
oldCommand.CanExecuteChanged -= button.CanExecuteChanged;
}
if (newCommand != null)
{
newCommand.CanExecuteChanged += button.CanExecuteChanged;
}
button.CanExecuteChanged(button, EventArgs.Empty);
}
}
示例15: ContentChanged
/// <summary>
/// Called when the <see cref="Content"/> property changes.
/// </summary>
/// <param name="e">The event args.</param>
private void ContentChanged(PerspexPropertyChangedEventArgs e)
{
_createdChild = false;
InvalidateMeasure();
}