Here are the examples of the csharp api System.Windows.Input.ICommand.Execute(object) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
833 Examples
19
View Source File : SegmentedControl.cs
License : MIT License
Project Creator : 1iveowl
License : MIT License
Project Creator : 1iveowl
[EditorBrowsable(EditorBrowsableState.Never)]
public void RaiseSelectionChanged()
{
OnSegmentSelected?.Invoke(this, new SegmentSelectEventArgs { NewValue = this.SelectedSegment });
if (!(SegmentSelectedCommand is null) && SegmentSelectedCommand.CanExecute(SegmentSelectedCommandParameter))
{
SegmentSelectedCommand.Execute(SegmentSelectedCommandParameter);
}
}
19
View Source File : InvokeCommandAction.cs
License : MIT License
Project Creator : 1iveowl
License : MIT License
Project Creator : 1iveowl
public async Task<bool> Execute(object sender, object parameter)
{
if (Command is null)
{
return false;
}
object resolvedParameter;
if (!(CommandParameter is null))
{
resolvedParameter = CommandParameter;
}
else if (!(Converter is null))
{
resolvedParameter = Converter.Convert(parameter, typeof(object), ConverterParameter, null);
}
else
{
resolvedParameter = parameter;
}
if (!Command.CanExecute(resolvedParameter))
{
return false;
}
Command.Execute(resolvedParameter);
await Task.CompletedTask;
return true;
}
19
View Source File : CodeBoxControl.xaml.cs
License : MIT License
Project Creator : Abdesol
License : MIT License
Project Creator : Abdesol
public void ButtonClicked(object sender, EventArgs e) => Command?.Execute(CommandParameter);
19
View Source File : SearchBarControl.xaml.cs
License : MIT License
Project Creator : Abdesol
License : MIT License
Project Creator : Abdesol
private void InActivity(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Text))
{
if (OldText == Text)
{
if (letsType)
{
OldText = "";
SearchedText = Text;
SearchCommand?.Execute(Text);
activityTimer.IsEnabled = false;
}
}
else
{
if(SearchedText != Text) OldText = Text;
else
{
exitBtn.Visibility = Visibility.Visible;
circularBar.Visibility = Visibility.Hidden;
}
}
}
}
19
View Source File : SearchBarControl.xaml.cs
License : MIT License
Project Creator : Abdesol
License : MIT License
Project Creator : Abdesol
private void ClearClicked(object sender, EventArgs e)
{
searchBox.Text = "";
SearchCommand?.Execute("");
letsType = false;
}
19
View Source File : SearchBarControl.axaml.cs
License : MIT License
Project Creator : Abdesol
License : MIT License
Project Creator : Abdesol
private void InActivity(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Text))
{
if (OldText == Text)
{
if (letsType)
{
OldText = "";
SearchedText = Text;
SearchCommand?.Execute(Text);
activityTimer.IsEnabled = false;
}
}
else
{
if (SearchedText != Text) OldText = Text;
else
{
exitBtn.IsVisible = true;
circularBar.IsVisible = false;//Todo: maybe can be better "IsEnabled = false, Opacity = 0" .Visibility = Visibility.Hidden;
}
}
}
}
19
View Source File : ExampleHelpers.cs
License : MIT License
Project Creator : ABTSoftware
License : MIT License
Project Creator : ABTSoftware
private static void DoLoaded(object sender, EventArgs e)
{
TimedMethod.Invoke(() =>
{
var command = GetLoadedEventCommand((DependencyObject)sender);
if (command != null)
{
command.Execute(null);
}
}).After(200).Go();
}
19
View Source File : ExampleHelpers.cs
License : MIT License
Project Creator : ABTSoftware
License : MIT License
Project Creator : ABTSoftware
private static void OnUnloadedEventCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var fe = d as FrameworkElement;
if (fe != null)
{
fe.Unloaded += (s, arg) =>
{
var command = GetUnloadedEventCommand(fe);
if (command != null)
{
command.Execute(null);
}
};
}
}
19
View Source File : EventToCommandBehavior.cs
License : MIT License
Project Creator : ABTSoftware
License : MIT License
Project Creator : ABTSoftware
private void ExecuteCommand(object sender, EventArgs e)
{
object parameter = this.PreplacedArguments ? e : null;
if (this.Command != null)
{
if (this.Command.CanExecute(parameter))
this.Command.Execute(parameter);
}
}
19
View Source File : InvokeCommandActionEx.cs
License : MIT License
Project Creator : ABTSoftware
License : MIT License
Project Creator : ABTSoftware
protected override void Invoke(object parameter)
{
var eventArgs = parameter as SelectionChangedEventArgs;
if (eventArgs != null)
{
var selectedSeries = (eventArgs.AddedItems.Count > 0 ? eventArgs.AddedItems[0] : null) as BaseRenderableSeries;
if (selectedSeries != null && SnapToSelectedSeriesCommand != null)
{
SnapToSelectedSeriesCommand.Execute(selectedSeries);
}
}
}
19
View Source File : DigitalAnalyzerScrollBehavior.cs
License : MIT License
Project Creator : ABTSoftware
License : MIT License
Project Creator : ABTSoftware
private void ScrollViewer_OnPreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
if (Keyboard.Modifiers.HasFlag(ModifierKeys.Shift))
{
if (ChangeChannelHeightCommand?.CanExecute(null) != true) return;
ChangeChannelHeightCommand.Execute(e.Delta > 0 ? ChannelHeightDelta : -ChannelHeightDelta);
e.Handled = true;
}
else if (Keyboard.Modifiers.HasFlag(ModifierKeys.Control))
{
if (!(sender is ScrollViewer scroll)) return;
scroll.ScrollToVerticalOffset(scroll.VerticalOffset - e.Delta);
e.Handled = true;
}
}
19
View Source File : SignInView.vm.cs
License : MIT License
Project Creator : Accelerider
License : MIT License
Project Creator : Accelerider
public void OnLoaded(SignInView view)
{
var preplacedwordBox = view.PreplacedwordBox;
// 1. Login info from SignUpView
if (_signUpArgs != null)
{
IsRememberPreplacedword = false;
IsAutoSignIn = false;
Email = _signUpArgs.Username;
preplacedwordBox.Preplacedword = _signUpArgs.Preplacedword;
SignInCommand.Execute(preplacedwordBox);
_signUpArgs = null;
return;
}
// 2. If there is some residual information on username or preplacedword text box, no login information is loaded from elsewhere.
if (!string.IsNullOrEmpty(Email) || !string.IsNullOrEmpty(preplacedwordBox.Preplacedword)) return;
// 3. No login info from config file.
if (!CanSignIn(_settings.Username, _settings.Preplacedword)) return;
// 4. Login info from config file.
IsRememberPreplacedword = true;
IsAutoSignIn = _settings.AutoLogin;
Email = _settings.Username;
preplacedwordBox.Preplacedword = _settings.Preplacedword.DecryptByRijndael();
if (IsAutoSignIn)
{
SignInCommand.Execute(preplacedwordBox);
}
}
19
View Source File : SettingItem.xaml.cs
License : MIT License
Project Creator : Accelerider
License : MIT License
Project Creator : Accelerider
private void SettingItem_OnMouseUp(object sender, MouseButtonEventArgs e)
{
if (Command?.CanExecute(CommandParameter) ?? false) Command.Execute(CommandParameter);
}
19
View Source File : SearchBar.xaml.cs
License : MIT License
Project Creator : Accelerider
License : MIT License
Project Creator : Accelerider
private void PART_SearchBox_TextChanged(object sender, TextChangedEventArgs e)
{
var text = PART_SearchBox.Text;
if (IsRealTimeMode &&
!string.IsNullOrEmpty(text) &&
SearchCommand.CanExecute(text))
{
SearchCommand.Execute(text);
}
}
19
View Source File : CommandExtensions.cs
License : MIT License
Project Creator : Accelerider
License : MIT License
Project Creator : Accelerider
public static void Invoke(this ICommand @this, object parameter = null)
{
if (@this != null && @this.CanExecute(parameter)) @this.Execute(parameter);
}
19
View Source File : ExpressionEditorService.cs
License : MIT License
Project Creator : Actipro
License : MIT License
Project Creator : Actipro
private void OnEditorLostFocus(object sender, EventArgs e) {
var editor = sender as IExpressionEditorInstance;
if (editor != null)
DesignerView.CommitCommand.Execute(editor.Text);
}
19
View Source File : VideoPlayer.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
public void Play()
{
PlayCommand.Execute(null);
}
19
View Source File : VideoPlayer.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
public void Pause()
{
PauseCommand.Execute(null);
}
19
View Source File : VideoPlayer.cs
License : MIT License
Project Creator : adamfisher
License : MIT License
Project Creator : adamfisher
public void Seek(int time)
{
SeekCommand.Execute(time.ToString());
}
19
View Source File : EventToCommand.cs
License : GNU General Public License v3.0
Project Creator : aduskin
License : GNU General Public License v3.0
Project Creator : aduskin
protected override void Invoke(object parameter)
{
if (replacedociatedElementIsDisabled() && !AlwaysInvokeCommand)
return;
var command = GetCommand();
var parameter1 = CommandParameterValue;
if (parameter1 == null && PreplacedEventArgsToCommand)
parameter1 = EventArgsConverter == null
? parameter
: EventArgsConverter.Convert(parameter, EventArgsConverterParameter);
if (command == null || !command.CanExecute(parameter1))
return;
command.Execute(parameter1);
}
19
View Source File : InvokeCommandAction.cs
License : GNU General Public License v3.0
Project Creator : aduskin
License : GNU General Public License v3.0
Project Creator : aduskin
protected override void Invoke(object parameter)
{
if (replacedociatedObject == null)
return;
var command = ResolveCommand();
if (command == null || !command.CanExecute(CommandParameter))
return;
command.Execute(CommandParameter);
}
19
View Source File : CommandReference.cs
License : GNU Affero General Public License v3.0
Project Creator : akshinmustafayev
License : GNU Affero General Public License v3.0
Project Creator : akshinmustafayev
public void Execute(object parameter)
{
Command.Execute(parameter);
}
19
View Source File : InfiniteScrollBehavior.cs
License : GNU General Public License v3.0
Project Creator : alexdillon
License : GNU General Public License v3.0
Project Creator : alexdillon
protected override void OnAttached()
{
base.OnAttached();
Observable.FromEventPattern(this.replacedociatedObject, nameof(this.replacedociatedObject.LayoutUpdated))
.Take(1)
.Subscribe(_ =>
{
var scrollViewer = this.replacedociatedObject.Scroll as ScrollViewer;
scrollViewer.GetObservable(ScrollViewer.VerticalScrollBarMaximumProperty)
.Subscribe(vscroll =>
{
this.verticalHeightMax = vscroll;
if (this.LockedToBottom)
{
// Scroll to bottom
scrollViewer.SetValue(ScrollViewer.VerticalScrollBarValueProperty, this.verticalHeightMax);
}
})
.DisposeWith(this.disposables);
scrollViewer.GetObservable(ScrollViewer.OffsetProperty)
.ForEachAsync(offset =>
{
if (scrollViewer.Extent.Height == 0)
{
this.LockedToBottom = scrollViewer.Bounds.Height == 0;
}
if (offset.Y <= double.Epsilon)
{
// At top
if (this.ReachedTopCommand.CanExecute(scrollViewer))
{
this.ReachedTopCommand.Execute(scrollViewer);
}
}
var delta = Math.Abs(this.verticalHeightMax - offset.Y);
if (delta <= double.Epsilon)
{
// At bottom
this.replacedociatedObject.SetValue(InfiniteScrollBehaviorPositionHelper.IsNotAtBottomProperty, false);
this.LockedToBottom = true;
}
else
{
// Not at bottom
this.replacedociatedObject.SetValue(InfiniteScrollBehaviorPositionHelper.IsNotAtBottomProperty, true);
this.LockedToBottom = false;
}
})
.DisposeWith(this.disposables);
});
}
19
View Source File : TextBoxSendBehavior.cs
License : GNU General Public License v3.0
Project Creator : alexdillon
License : GNU General Public License v3.0
Project Creator : alexdillon
private void replacedociatedObject_KeyDown(object sender, KeyEventArgs e)
{
var controlPressed = e.KeyModifiers.HasFlag(KeyModifiers.Control);
var shiftPressed = e.KeyModifiers.HasFlag(KeyModifiers.Shift);
if ((e.Key == Key.Enter || e.Key == Key.Return) &&
(!controlPressed && !shiftPressed))
{
// Enter or Return has been pressed without any modifiers
// Remove the newline character that Avalonia's textbox will automatically insert
// Then, invoke send behavior
var beforeCaret = this.replacedociatedObject.Text.Substring(0, this.replacedociatedObject.CaretIndex);
var afterCaret = this.replacedociatedObject.Text.Substring(this.replacedociatedObject.CaretIndex);
beforeCaret = beforeCaret.Substring(0, beforeCaret.LastIndexOf(this.replacedociatedObject.NewLine));
var newString = $"{beforeCaret}{afterCaret}";
this.replacedociatedObject.Text = newString;
this.SendCommand?.Execute(null);
}
else if (e.Key == Key.Enter || e.Key == Key.Return)
{
// No special behavior is required. Enter has been pressed with a modifier key.
// Allow Avalonia's TextBox to automatically handle newline insertion.
}
}
19
View Source File : LoginViewModel.cs
License : GNU General Public License v3.0
Project Creator : alexdillon
License : GNU General Public License v3.0
Project Creator : alexdillon
private async Task WaitForLogin()
{
var authKeyResult = await this.OAuthClient.GetAuthToken();
this.OAuthClient.Stop();
this.SettingsManager.CoreSettings.AuthToken = authKeyResult;
this.SettingsManager.SaveSettings();
this.LoginCompleted?.Execute(this);
}
19
View Source File : GroupContentsControlViewModel.cs
License : GNU General Public License v3.0
Project Creator : alexdillon
License : GNU General Public License v3.0
Project Creator : alexdillon
private void PopoutMiniChat()
{
var windowService = Ioc.Default.GetService<IWindowService>();
windowService.ShowWindow(new WindowParams()
{
Content = this,
replacedle = this.replacedle,
Width = 350,
Height = 550,
TopMost = true,
StartingLocation = this.Settings.UISettings.MiniChatOpenLocation,
StartingX = this.Settings.UISettings.MiniChatManualX,
StartingY = this.Settings.UISettings.MiniChatManualY,
Tag = this.Id,
CloseCallback = () => this.CloseMiniChat?.Execute(this),
});
this.RegisterAsMiniChat.Execute(this);
this.ShowDisplayOptions = false;
}
19
View Source File : ListBoxExtensions.cs
License : GNU General Public License v3.0
Project Creator : alexdillon
License : GNU General Public License v3.0
Project Creator : alexdillon
private static void OnListBoxScrollChanged(object sender, ScrollChangedEventArgs e)
{
var scrollViewer = (ScrollViewer)sender;
var listBox = scrollViewer.TemplatedParent as ListBox;
var topSnap = GetTopLoadingSnap(listBox);
var bottomSnap = GetBottomLoadingSnap(listBox);
if (bottomSnap > 0)
{
scrollViewer.UpdateLayout();
scrollViewer.ScrollToVerticalOffset(bottomSnap);
scrollViewer.UpdateLayout();
SetBottomLoadingSnap(listBox, 0);
return;
}
else if (topSnap != 0)
{
// Calculate the offset where the last message the user was looking at is
// Scroll back to there so new messages appear on top, above screen
scrollViewer.UpdateLayout();
double newHeight = scrollViewer?.ExtentHeight ?? 0.0;
double difference = newHeight - topSnap;
scrollViewer.ScrollToVerticalOffset(difference);
SetTopLoadingSnap(listBox, 0);
return;
}
// Check to see if scrolled to top
if (scrollViewer.VerticalOffset == 0)
{
var command = GetScrollToTop(listBox);
if (command != null && command.CanExecute(null))
{
// Save the original position to allow us to return to it when the UI update is completed
double originalHeight = scrollViewer?.ExtentHeight ?? 0.0;
double originalOffset = scrollViewer?.VerticalOffset ?? 0.0;
// Run the At-Top handler
scrollViewer.CanContentScroll = false;
SetTopLoadingSnap(listBox, (int)originalHeight);
command.Execute(scrollViewer);
scrollViewer.CanContentScroll = true;
}
}
else if ((int)scrollViewer.VerticalOffset == (int)scrollViewer.ScrollableHeight)
{
if (e.VerticalChange < 1000)
{
var command = GetScrollToBottom(listBox);
if (command != null && command.CanExecute(null))
{
// Save the original position to allow us to return to it when the UI update is completed
double originalHeight = scrollViewer?.ExtentHeight ?? 0.0;
double originalOffset = scrollViewer?.VerticalOffset ?? 0.0;
// Run the At-Bottom handler
scrollViewer.CanContentScroll = false;
SetBottomLoadingSnap(listBox, (int)originalOffset);
command.Execute(scrollViewer);
scrollViewer.CanContentScroll = true;
}
}
}
}
19
View Source File : PopupViewModel.cs
License : GNU General Public License v3.0
Project Creator : alexdillon
License : GNU General Public License v3.0
Project Creator : alexdillon
private void CheckEasyCloseHandler(object e)
{
if (e is PointerPressedEventArgs pointerPressedEvent)
{
if (pointerPressedEvent.GetCurrentPoint(null).Properties.PointerUpdateKind == PointerUpdateKind.LeftButtonPressed)
{
this.EasyClosePopup?.Execute(null);
}
}
}
19
View Source File : DropDownButton.xaml.cs
License : MIT License
Project Creator : alexleen
License : MIT License
Project Creator : alexleen
private void AddAppenderItemOnClick(object sender, MouseButtonEventArgs e)
{
object dataContext = ((FrameworkElement)sender).DataContext;
ItemClick?.Invoke(dataContext);
Command?.Execute(dataContext);
}
19
View Source File : FlexLayoutTappedBehavior.cs
License : MIT License
Project Creator : Altevir
License : MIT License
Project Creator : Altevir
private void OnTapped(object sender, EventArgs e)
{
if (sender is BindableObject bindable && this.Command != null && this.Command.CanExecute(null))
{
this.Command.Execute(bindable.BindingContext);
}
}
19
View Source File : ContentDialog.cs
License : MIT License
Project Creator : amwx
License : MIT License
Project Creator : amwx
private void HandlePrimaryClick()
{
var ea = new ContentDialogButtonClickEventArgs(this);
OnPrimaryButtonClick(ea);
if (ea.Cancel)
return;
result = ContentDialogResult.Primary;
if (!ea.IsDeferred)
{
if (PrimaryButtonCommand != null && PrimaryButtonCommand.CanExecute(PrimaryButtonCommandParameter))
{
PrimaryButtonCommand.Execute(PrimaryButtonCommandParameter);
}
HideCore();
}
else
{
IsEnabled = false;
}
}
19
View Source File : ContentDialog.cs
License : MIT License
Project Creator : amwx
License : MIT License
Project Creator : amwx
private void HandleCloseClick()
{
var ea = new ContentDialogButtonClickEventArgs(this);
OnCloseButtonClick(ea);
if (ea.Cancel)
return;
result = ContentDialogResult.None;
if (!ea.IsDeferred)
{
if (CloseButtonCommand != null && CloseButtonCommand.CanExecute(CloseButtonCommandParameter))
{
CloseButtonCommand.Execute(CloseButtonCommandParameter);
}
HideCore();
}
else
{
IsEnabled = false;
}
}
19
View Source File : MenuFlyoutItem.cs
License : MIT License
Project Creator : amwx
License : MIT License
Project Creator : amwx
protected virtual void OnClick()
{
RaiseEvent(new RoutedEventArgs(MenuItem.ClickEvent));
if (Command?.CanExecute(CommandParameter) == true)
{
Command.Execute(CommandParameter);
}
}
19
View Source File : XamlUICommand.cs
License : MIT License
Project Creator : amwx
License : MIT License
Project Creator : amwx
public void Execute(object param)
{
var args = new ExecuteRequestedEventArgs(param);
ExecuteRequested?.Invoke(this, args);
Command?.Execute(param);
}
19
View Source File : ContentDialog.cs
License : MIT License
Project Creator : amwx
License : MIT License
Project Creator : amwx
private void HandleSecondaryClick()
{
var ea = new ContentDialogButtonClickEventArgs(this);
OnSecondaryButtonClick(ea);
if (ea.Cancel)
return;
result = ContentDialogResult.Secondary;
if (!ea.IsDeferred)
{
if (SecondaryButtonCommand != null && SecondaryButtonCommand.CanExecute(SecondaryButtonCommandParameter))
{
SecondaryButtonCommand.Execute(SecondaryButtonCommandParameter);
}
HideCore();
}
else
{
IsEnabled = false;
}
}
19
View Source File : Timeline.cs
License : GNU General Public License v3.0
Project Creator : AndreiFedarets
License : GNU General Public License v3.0
Project Creator : AndreiFedarets
internal void OnOpenRequest(ISingleEventTree eventTree)
{
ICommand command = OpenCommand;
if (command != null)
{
command.Execute(eventTree);
}
}
19
View Source File : ControlEventCommandBehavior.cs
License : GNU General Public License v3.0
Project Creator : AndreiFedarets
License : GNU General Public License v3.0
Project Creator : AndreiFedarets
protected virtual void ExecuteCommand()
{
ExtendedCommandBase extendedCommandBase = Command as ExtendedCommandBase;
if (extendedCommandBase != null)
{
extendedCommandBase.ExecuteInternal(CommandParameter);
}
else if (Command != null)
{
Command.Execute(CommandParameter);
}
}
19
View Source File : SwipeActionContextMenuView.cs
License : MIT License
Project Creator : AndreiMisiukevich
License : MIT License
Project Creator : AndreiMisiukevich
private void OnContextMenuOpened(BaseContextMenuView menuView)
{
Device.BeginInvokeOnMainThread(() =>
{
if (ContextMenu.IsAutoCloseEnabled)
{
ContextMenu.ForceClose();
}
Moved?.Invoke(BindingContext);
MovedCommand?.Execute(BindingContext);
});
}
19
View Source File : GridViewSorting.cs
License : GNU General Public License v3.0
Project Creator : AndreiFedarets
License : GNU General Public License v3.0
Project Creator : AndreiFedarets
private static void OnColumnHeaderClick(object sender, RoutedEventArgs e)
{
GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader;
if (headerClicked != null)
{
string propertyName = GetPropertyName(headerClicked.Column);
if (!string.IsNullOrEmpty(propertyName))
{
ListView listView = GetAncestor<ListView>(headerClicked);
if (listView != null)
{
ICommand command = GetCommand(listView);
if (command != null)
{
if (command.CanExecute(propertyName))
{
command.Execute(propertyName);
}
}
else if (GetAutoSort(listView))
{
ApplySort(listView.Items, propertyName);
}
}
}
}
}
19
View Source File : EventToCommandBehavior.cs
License : MIT License
Project Creator : AndyCW
License : MIT License
Project Creator : AndyCW
void OnEvent(object sender, object eventArgs)
{
if (Command == null)
{
return;
}
object resolvedParameter;
if (CommandParameter != null)
{
resolvedParameter = CommandParameter;
}
else if (Converter != null)
{
resolvedParameter = Converter.Convert(eventArgs, typeof(object), null, null);
}
else
{
resolvedParameter = eventArgs;
}
if (Command.CanExecute(resolvedParameter))
{
Command.Execute(resolvedParameter);
}
}
19
View Source File : Entry.cs
License : MIT License
Project Creator : angelobelchior
License : MIT License
Project Creator : angelobelchior
private void ExecuteCompletedCommand()
{
if (this.CompletedCommand != null)
if (this.CompletedCommand.CanExecute(this.CompletedCommandParameter))
this.CompletedCommand.Execute(this.CompletedCommandParameter);
}
19
View Source File : ListView.cs
License : MIT License
Project Creator : angelobelchior
License : MIT License
Project Creator : angelobelchior
private void ListView_ItemTapped(object sender, ItemTappedEventArgs e)
{
if (ItemTappedCommand != null && ItemTappedCommand.CanExecute(null))
ItemTappedCommand.Execute(e.Item);
}
19
View Source File : ListView.cs
License : MIT License
Project Creator : angelobelchior
License : MIT License
Project Creator : angelobelchior
private void InfiniteListView_ItemAppearing(object sender, ItemVisibilityEventArgs e)
{
var items = ItemsSource as IList;
if (items != null && e.Item == items[items.Count - 3])
{
if (InfiniteScrollCommand != null && InfiniteScrollCommand.CanExecute(null))
InfiniteScrollCommand.Execute(null);
}
}
19
View Source File : Picker.cs
License : MIT License
Project Creator : angelobelchior
License : MIT License
Project Creator : angelobelchior
private void OnSelectedItemPropertyChanged()
{
if (this.ItemsSource == null) return;
this.SelectedIndex = this.IndexOf(this.SelectedItem);
if (this.SelectedItemChangedCommand != null && this.SelectedItemChangedCommand.CanExecute(this.SelectedItem))
this.SelectedItemChangedCommand.Execute(this.SelectedItem);
}
19
View Source File : EventToCommandBehavior.cs
License : MIT License
Project Creator : anjoy8
License : MIT License
Project Creator : anjoy8
private void OnFired(object sender, EventArgs eventArgs)
{
if (Command == null)
return;
var parameter = CommandParameter;
if (eventArgs != null && eventArgs != EventArgs.Empty)
{
parameter = eventArgs;
if (EventArgsConverter != null)
{
parameter = EventArgsConverter.Convert(eventArgs, typeof(object), EventArgsConverterParameter, CultureInfo.CurrentUICulture);
}
}
if (Command.CanExecute(parameter))
{
Command.Execute(parameter);
}
}
19
View Source File : ControlDoubleClickBehavior.cs
License : Apache License 2.0
Project Creator : AnkiUniversal
License : Apache License 2.0
Project Creator : AnkiUniversal
static void control_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var control = sender as Control;
if(control != null)
{
var command = control.GetValue(ExecuteCommand) as ICommand;
var commandParameter = control.GetValue(ExecuteCommandParameter);
if (command.CanExecute(e))
{
command.Execute(commandParameter);
}
}
}
19
View Source File : ContextMenuItem.cs
License : MIT License
Project Creator : anpin
License : MIT License
Project Creator : anpin
internal void OnItemTapped()
{
ItemTapped?.Invoke(this, new EventArgs());
if (Command?.CanExecute(CommandParameter) ?? false && IsEnabled)
{
Command.Execute(CommandParameter);
}
}
19
View Source File : WindowClosingBehaviour.cs
License : MIT License
Project Creator : AntonyCorbett
License : MIT License
Project Creator : AntonyCorbett
private static void OnWindowClosed(object? sender, EventArgs e)
{
var closed = GetClosed(sender as Window);
closed?.Execute(null);
}
19
View Source File : WindowClosingBehaviour.cs
License : MIT License
Project Creator : AntonyCorbett
License : MIT License
Project Creator : AntonyCorbett
private static void OnWindowClosing(object sender, CancelEventArgs e)
{
var closing = GetClosing(sender as Window);
if (closing != null)
{
if (closing.CanExecute(null))
{
closing.Execute(null);
}
else
{
var cancelClosing = GetCancelClosing(sender as Window);
cancelClosing?.Execute(null);
e.Cancel = true;
}
}
}
19
View Source File : WindowClosingBehaviour.cs
License : MIT License
Project Creator : AntonyCorbett
License : MIT License
Project Creator : AntonyCorbett
private static void OnWindowClosed(object sender, EventArgs e)
{
var closed = GetClosed(sender as Window);
closed?.Execute(null);
}
See More Examples