public void CreateStockRecords() { //TODO // Two ways: // 1)Generate first only "realistic values" - near // the limits than generate other values in background // 2)Generate othre values scrolling the list // for (int i = _parCountOfSteps; i > 0; i--) { CStockRecord sr = new CStockRecord(i * _minStep); ListBoxStock.Items.Add(sr); } // ListBoxStock.ScrollIntoView(ListBoxStock.Items[10000]); const int tick = 100; //tick= 100ns const int _1ms = 10 * tick; DispatcherTimer dt = new DispatcherTimer(); dt.Tick += new EventHandler(dispatcherTimer_Tick); dt.Interval = new TimeSpan(100 * _1ms); // new TimeSpan(0,0,1); dt.Start(); }
private void ListViewItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { var item = sender as ListBoxItem; if (item != null /*&& item.IsSelected*/) { CStockRecord sr = (CStockRecord)item.Content; //Do your stuff } } catch (Exception err) { } }