private void RemoveWatchListSelection_Click(object sender, RoutedEventArgs e) { WatchListEntry entryToBeRemoved = null; foreach (var item in WatchListListView.Items) { var watchListItem = item as WatchListEntry; var container = WatchListListView.ContainerFromItem(watchListItem) as ListViewItem; var ItemGridView = container.ContentTemplateRoot as Grid; SolidColorBrush brush = ItemGridView.Background as SolidColorBrush; if (brush != null) { if (brush.Color == WatchListSelectionColor) { ItemGridView.Background = null; entryToBeRemoved = watchListItem; } } } if (entryToBeRemoved != null) { watchListEntries.Remove(entryToBeRemoved); } }
private void ClearWatchList_Click(object sender, RoutedEventArgs e) { foreach (var item in WatchListListView.Items) { var watchListItem = item as WatchListEntry; var container = WatchListListView.ContainerFromItem(watchListItem) as ListViewItem; var ItemGridView = container.ContentTemplateRoot as Grid; ItemGridView.Background = null; } watchListEntries.Clear(); }
private void WatchListListView_ItemClick(object sender, ItemClickEventArgs e) { var watchListEntry = (WatchListEntry)e.ClickedItem; this.GenerateChart("1m", watchListEntry.Symbol.ToLower()); ChartTickerInput.Text = watchListEntry.Symbol.ToUpper(); foreach (var item in WatchListListView.Items) { var watchListItem = item as WatchListEntry; var container = WatchListListView.ContainerFromItem(watchListItem) as ListViewItem; var ItemGridView = container.ContentTemplateRoot as Grid; if (watchListItem.Symbol.ToLower() == watchListEntry.Symbol.ToLower()) { SolidColorBrush brush = ItemGridView.Background as SolidColorBrush; if (brush != null) { if (brush.Color == WatchListSelectionColor) { ItemGridView.Background = null; } else { ItemGridView.Background = new SolidColorBrush(WatchListSelectionColor); } } else { ItemGridView.Background = new SolidColorBrush(WatchListSelectionColor); } } else { ItemGridView.Background = null; } } }