private void OnSelectedItemChangedCommand(object newValue)
        {
            if (SelectedItemChangedCommand != null && SelectedItemChangedCommand.CanExecute(newValue))
            {
                SelectedItemChangedCommand.Execute(newValue);
            }

            if (_selfSelectedElement)
            {
                return;
            }

            _selfSelectedElement = true;
            SelectedElement      = newValue;
            _selfSelectedElement = false;
        }
Esempio n. 2
0
        void UpdateSelected(object selected, EventArgs e)
        {
            foreach (var item in this.Children)
            {
                if (item is RadioButton)
                    (item as RadioButton).IsChecked = item == selected;
            }

            SetValue(SelectedItemProperty, this.SelectedItem);
            OnPropertyChanged(nameof(SelectedItem));
            SetValue(SelectedIndexProperty, this.SelectedIndex);
            OnPropertyChanged(nameof(SelectedIndex));
            SelectedItemChanged?.Invoke(this, new EventArgs());
            if (SelectedItemChangedCommand?.CanExecute(CommandParameter ?? this) ?? false)
                SelectedItemChangedCommand?.Execute(CommandParameter ?? this);
            ValidationChanged?.Invoke(this, new EventArgs());
        }
Esempio n. 3
0
        private void SelectedItemChangedHandler(object selectedItem)
        {
            if (m_autocompleteItemsControl != null)
            {
                m_autocompleteItemsControl.ItemsSource = null;
            }

            UpdateClearButtonVisibility();

            SelectedItemChangedEventArgs eventArgs = new SelectedItemChangedEventArgs(SelectedItemChangedEvent, this, selectedItem);

            RaiseEvent(eventArgs);

            if (SelectedItemChangedCommand != null && SelectedItemChangedCommand.CanExecute(selectedItem))
            {
                SelectedItemChangedCommand.Execute(selectedItem);
            }
        }
Esempio n. 4
0
        private void LongListSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (SelectedItem == null)
            {
                return;
            }
            if (SelectedItemChangedCommand == null)
            {
                return;
            }
            if (!SelectedItemChangedCommand.CanExecute(null))
            {
                return;
            }

            SelectedItemChangedCommand.Execute(SelectedItem);

            SelectedItem = null;
        }