@@ -28,6 +28,7 @@ public partial class MainWindow : ContentPage
2828 {
2929 this.InitializeComponent();
3030 SfFunnelChart chart = new SfFunnelChart();
31+ this.Content = chart;
3132 }
3233}
3334```
@@ -72,39 +73,39 @@ Now, let us define a simple data model that represents a data point in the chart
7273
7374** [ C#] **
7475```
75- public class Admission
76+ public class AdmissionModel
7677{
7778 public string XValue { get; set; }
7879 public double YValue { get; set; }
7980}
8081```
8182
82- Next, create a view model class and initialize a list of ` Model ` objects as follows.
83+ Next, create a AdmissionViewModel class and initialize a list of ` AdmissionModel ` objects as follows.
8384
8485** [ C#] **
8586```
86- public class ChartViewModel
87+ public class AdmissionViewModel
8788{
88- public List<Admission > Data { get; set; }
89+ public List<AdmissionModel > Data { get; set; }
8990
90- public ChartViewModel ()
91+ public AdmissionViewModel ()
9192 {
92- Data = new List<Admission >()
93+ Data = new List<AdmissionModel >()
9394 {
94- new Admission () {XValue = "Enrolled", YValue=175},
95- new Admission () {XValue = "Admits", YValue=190},
96- new Admission () {XValue = "Applicants", YValue=245},
97- new Admission () {XValue = "Inquiries ", YValue=290},
98- new Admission () {XValue = "Prospects ", YValue=320},
95+ new AdmissionModel () {XValue = "Enrolled", YValue=175},
96+ new AdmissionModel () {XValue = "Admits", YValue=190},
97+ new AdmissionModel () {XValue = "Applicants", YValue=245},
98+ new AdmissionModel () {XValue = "Inquiries ", YValue=290},
99+ new AdmissionModel () {XValue = "Prospects ", YValue=320},
99100 };
100101 }
101102}
102103```
103104
104- Create a ` ViewModel ` instance and set it as the chart's ` BindingContext ` . This enables property binding from ` ViewModel ` class.
105+ Create a ` AdmissionViewModel ` instance and set it as the chart's ` BindingContext ` . This enables property binding from ` AdmissionViewModel ` class.
105106
106107> ** _ Note:_ **
107- Add the namespace of ` ViewModel ` class to your XAML Page, if you prefer to set ` BindingContext ` in XAML.
108+ Add the namespace of ` AdmissionViewModel ` class to your XAML Page, if you prefer to set ` BindingContext ` in XAML.
108109
109110** [ XAML] **
110111```
@@ -115,15 +116,16 @@ Add the namespace of `ViewModel` class to your XAML Page, if you prefer to set `
115116
116117 <chart:SfFunnelChart>
117118 <chart:SfFunnelChart.BindingContext>
118- <model:ChartViewModel />
119+ <model:AdmissionViewModel />
119120 </chart:SfFunnelChart.BindingContext>
120121 </chart:SfFunnelChart>
121122</ContentPage>
122123```
123124
124125** [ C#] **
125126```
126- ChartViewModel viewModel = new ChartViewModel();
127+ SfFunnelChart chart = new SfFunnelChart();
128+ AdmissionViewModel viewModel = new AdmissionViewModel();
127129chart.BindingContext = viewModel;
128130```
129131
@@ -143,7 +145,7 @@ chart.BindingContext = viewModel;
143145** [ C#] **
144146```
145147SfFunnelChart chart = new SfFunnelChart();
146- ChartViewModel viewModel = new ChartViewModel ();
148+ AdmissionViewModel viewModel = new AdmissionViewModel ();
147149chart.BindingContext = viewModel;
148150chart.ItemsSource = viewModel.Data;
149151chart.XBindingPath = "XValue";
@@ -244,7 +246,7 @@ The following code example gives you the complete code of above configurations.
244246 <Label Text="School Admission"/>
245247 </chart:SfFunnelChart.Title>
246248 <chart:SfFunnelChart.BindingContext>
247- <model:ChartViewModel />
249+ <model:AdmissionViewModel />
248250 </chart:SfFunnelChart.BindingContext>
249251 <chart:SfFunnelChart.Legend>
250252 <chart:ChartLegend/>
@@ -266,7 +268,7 @@ public partial class MainPage : ContentPage
266268 Text = "School Admission"
267269 };
268270 chart.Legend = new ChartLegend();
269- ChartViewModel viewModel = new ChartViewModel ();
271+ AdmissionViewModel viewModel = new AdmissionViewModel ();
270272 chart.BindingContext = viewModel;
271273
272274 chart.ItemsSource = viewModel.Data;
0 commit comments