private void OnCheckBoxClick(object sender, RoutedEventArgs e) { var clickedBox = (CheckBox)sender; var content = clickedBox.Content.ToString(); SelectionChangedCommand?.Execute(clickedBox.DataContext); if (clickedBox.IsChecked.HasValue && clickedBox.IsChecked.Value) { _selectedItems.Add(content); } else if (clickedBox.IsChecked.HasValue && !clickedBox.IsChecked.Value) { _selectedItems.Remove(content); if (!_selectedItems.Any()) { Text = NoneCheckedText; return; } } var sb = new SeperatedStringBuilder(", "); foreach (var str in _selectedItems) { sb.Append(str); } Text = sb.ToString(); }
private void OnSelectionChanged() { if (SelectionChangedCommand != null && SelectionChangedCommand.CanExecute(SelectedItems)) { SelectionChangedCommand.Execute(SelectedItems); } }
private void TimerTick() { int currentTimerValue = trackTimer.CurrentTimerValue; if (SliderValue < SliderMaximumValue) { CurrentTimeAudio = TimeConverter.SecondsInString(currentTimerValue); SliderValue = currentTimerValue; } else { if (!_repeatAudio) { if (ListBoxSelectedIndex != AudioList.Count - 1) { ++ListBoxSelectedIndex; SelectionChangedCommand.Execute(null); PlayMusicCommand.Execute(null); } else { SelectionChangedCommand.Execute(null); } } else { SelectionChangedCommand.Execute(null); PlayMusicCommand.Execute(null); } } }
private void SelectedItemChangedCallback(object sender, RoutedPropertyChangedEventArgs <object> e) { if (SelectionChangedCommand != null && SelectionChangedCommand.CanExecute(e.NewValue)) { SelectionChangedCommand.Execute(e.NewValue); } }
protected override void OnSelectionChanged(SelectionChangedEventArgs e) { SelectedRows = SelectedItems; SelectionChangedCommandArgs selectionChangedCommandArgs = new SelectionChangedCommandArgs(e.AddedItems, e.RemovedItems); SelectionChangedCommand?.Execute(selectionChangedCommandArgs); base.OnSelectionChanged(e); }
protected override void OnSelectionChanged(SelectionChangedEventArgs e) { base.OnSelectionChanged(e); if (SelectionChangedCommand != null && SelectionChangedCommand.CanExecute(null)) { SelectionChangedCommand.Execute(null); } }
/// <summary> /// execute selectionchangedcommand /// </summary> /// <param name="e"></param> protected override void OnSelectionChanged(SelectionChangedEventArgs e) { base.OnSelectionChanged(e); if (SelectionChangedCommand == null) { return; } SelectionChangedCommand.Execute(SelectedItem); }
public ViewModelBase() { SelectedTorrentFilesViewModel = new SelectedTorrentFilesViewModel(); SelectedTorrentInfoViewModel = new SelectedTorrentInfoViewModel(); SelectedTorrentPeersViewModel = new SelectedTorrentPeersViewModel(); SelectedTorrentTrackersViewModel = new SelectedTorrentTrackersViewModel(); TorrentViewModel = new TorrentViewModel(); OpenFileDialogCommand = new OpenFileDialogCommand(this, new OpenFileDialogViewModel()); SelectionChangedCommand = new SelectionChangedCommand(this); StartDownloadCommand = new StartDownloadCommand(this, SelectedTorrentInfoViewModel); PauseDownloadCommand = new PauseDownloadCommand(this, SelectedTorrentInfoViewModel); }
protected override UICollectionViewCell GetOrCreateCellFor(UICollectionView collectionView, NSIndexPath indexPath, object item) { var cell = collectionView.DequeueReusableCell(PhotosCell.Key, indexPath) as PhotosCell; var singleTap = new UITapGestureRecognizer(s => { SelectionChangedCommand.Execute(item); }); cell.UserInteractionEnabled = true; cell.AddGestureRecognizer(singleTap); if (cell is IMvxDataConsumer bindable) { bindable.DataContext = item; } return(cell); }
private void OnInitialized(object sender, EventArgs e) { var diagram = sender as RadDiagram; if (diagram == null) { return; } diagram.SelectionMode = Telerik.Windows.Diagrams.Core.SelectionMode.Single; diagram.SelectionChanged += (s, args) => { if (args.AddedItems != null) { var selectedShapes = args.AddedItems .OfType <RadDiagramShape>() .Where(x => x.DataContext is HudBaseToolViewModel) .ToArray(); if (selectedShapes.Length > 0 && SelectionChangedCommand != null && SelectionChangedCommand.CanExecute(null)) { SelectionChangedCommand.Execute(null); } } }; var table = CreateTableRadDiagramShape(); var tableBackgroundImage = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(diagram), HudDefaultSettings.TableBackgroundImage)); RenderOptions.SetBitmapScalingMode(tableBackgroundImage, BitmapScalingMode.HighQuality); RenderOptions.SetEdgeMode(tableBackgroundImage, EdgeMode.Aliased); table.Background = new ImageBrush(tableBackgroundImage); diagram.AddShape(table); table.X = DiagramActualWidth(diagram) / 2 - table.Width / 2; table.Y = diagram.Height / 2 - table.Height / 2; dragDropShape = CreateDragDropRadDiagramShape(); DriveHUD.Common.Wpf.AttachedBehaviors.DragDrop.SetIsDragTarget(dragDropShape, true); diagram.AddShape(dragDropShape); }
public void CellSelected(object vm) { SelectionChangedCommand?.Execute(vm); }