Creating empty CandleChart
The CandleChart class, which derives from the UserControl class, provides you a simple way to create a candlestick chart control. CandleChart is declared inside the FancyCandles namespace, which is within the FancyCandles assembly.
After the FancyCandles project has been added to your solution or the FancyCandles NuGet package has been installed in your project, you can go on and create an instance of the CandleChart control in your project:
In the root tag of the MainWindow.xaml file of your project, declare the FancyCandles namespace. In this example we map this namespace to the fc: prefix:
<Window x:Class="MyProject.MainWindow" ... xmlns:fc="clr-namespace:FancyCandles;assembly=FancyCandles" ... >
Inside MainWindow.xaml, add the CandleChart control element:
<fc:CandleChart />
As a result your MainWindow.xaml may looks like this:
<Window x:Class="MyProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:ggg" xmlns:fc="clr-namespace:FancyCandles;assembly=FancyCandles" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <Grid> <fc:CandleChart CandlesSource="{Binding Path=.}"/> </Grid> </Window>
Congratulations! You have added the candlestick chart control to your application.
But it is empty yet and contains no candles! The next step is to populate it with candles.