void OnListBoxSelectionChanged(object sender, SelectionChangedEventArgs e) { object selected = (e.AddedItems.Count > 0) ? e.AddedItems[0] : null; AccountSectionHeader ash = selected as AccountSectionHeader; if (ash != null) { ash.OnClick(); } if (this.selected != selected && SelectionChanged != null) { this.selected = selected; SelectionChanged(this, EventArgs.Empty); } }
void RaiseSelectionEvent(AccountViewModel selected, bool force) { AccountSectionHeader ash = selected as AccountSectionHeader; if (ash != null) { ash.OnClick(); } if ((force || this.selected != selected) && SelectionChanged != null) { SetSelected(selected); // checked it really is a different account (could be different object // but the same account because of a rebind). if (!hideEvents) { SelectionChanged(this, EventArgs.Empty); } } }