using System; using System.Net; using System.Linq; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; using System.Collections.ObjectModel; using System.Xml.Linq; using System.Collections.Generic; using XAMLFinance.ViewModel.Command; using System.ComponentModel; using System.Diagnostics; namespace XAMLFinance.ViewModel { /// <summary> /// a view model which represents a heatmap /// </summary> public class HeatMapViewModel : NamedViewModelBase { /// <summary> /// Field which backs the Sectors property /// </summary> private List<SectorViewModel> _sectors = new List<SectorViewModel>(); public HeatMapViewModel() { Util.EnforceDesignTimeOnly("No arg constructor only needed for design time support"); } public HeatMapViewModel(XAMLFinanceViewModel parent) : base(parent) { _parent = parent; Title = "Heatmap"; } protected override void OnInit() { var dataSource = App.Current.DataSource; dataSource.GetHeatmap(heatmap => { var sectors = heatmap.Sectors.Select(sector => new SectorViewModel(_parent) { ChangePercent = sector.ChangePercent, MarketCap = sector.MarketCap, Name = sector.Name, Children = sector.Children.Select(instrumentPrice => new InstrumentPriceViewModel(_parent, instrumentPrice)).ToList() }); Sectors = sectors.ToList(); }); } /// <summary> /// Gets / sets the sectors /// </summary> public List<SectorViewModel> Sectors { get { return _sectors; } set { SetField(ref _sectors, value, "Sectors"); } } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)