

Create a new class in the project as follows: using Use the code below to read data from the file and populate the data source.

Specify the logical name in the project file as shown below.

Once added, right-click the file, go to properties, and set Build Action to Embedded resource. The JSON file contains an array of companies, with an array of daily historical stock prices for each.ĭownload the symbols.json file, and add this file to the solution. Right-click the project, click Add > Existing Item. This sample application uses static data formatted in JSON and stored in a file. The response can be formatted in HTML, XML, JSON, or any other format. Most mobile applications use a REST API to obtain data from a web service. StockPrice - contains open-close-high-low prices and transaction volume for a single day.Ĭreate a new class in the project and paste the following code: using System.Symbol - contains company name, ticker, and a collection of daily historical data.To store data, the application uses the following classes: This sample application follows the MVVM pattern. The next step is to populate the app with data. If we run the application as it stands, it will display an empty collection view on the main page. ConfigureFonts(fonts => fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular")) Handlers.AddHandler(typeof(ChartView), typeof(ChartViewHandler))) Handlers.AddHandler(typeof(IDXCollectionView), typeof(DXCollectionViewHandler))) Since we use a chart on the second page, we also register a handler for the ChartView type. In the MauiProgram.cs file, register a handler for the DXCollectionView type as shown below.
