The following example demonstrates how to add a new group with a new page to the Chart Wizard at runtime.
First, create a control that becomes a page's content. Create a new control that inherits from the WizardControlBase and drop the ChartControl onto it. This follows because the page is intended to customize the chart. The page should contain a chart control to display the changes as the settings are modified.
Then, use the following code to create a group and a page. You can handle the WizardPage.InitializePage event to get access to the contained chart control.
C# |
using DevExpress.XtraCharts.Wizard;
private void ShowNewWizard() {
ChartWizard wiz = new ChartWizard(this.chartControl1);
WizardGroup MyWizardGroup = wiz.RegisterGroup("NewGroup");
WizardPage MyWizardPage = MyWizardGroup.RegisterPage(typeof(UserControl1),
"MyPage", "MyHeader", "MyDesription", null);
MyWizardPage.InitializePage += new InitializePageEventHandler (MyWizardPage_InitializePage);
wiz.ShowDialog();
}
void MyWizardPage_InitializePage(object sender, InitializePageEventArgs e) {
e.Chart = ((UserControl1)e.Control).chartControl1;
}
|
VB |
Imports DevExpress.XtraCharts.Wizard
Private Sub ShowNewWizard()
Dim wiz As New ChartWizard(Me.chartControl1)
Dim MyWizardGroup As WizardGroup = wiz.RegisterGroup("NewGroup")
Dim MyWizardPage As WizardPage = MyWizardGroup.RegisterPage(GetType(UserControl1), _
"MyPage", "MyHeader", "MyDesription", Nothing)
AddHandler MyWizardPage.InitializePage, AddressOf MyWizardPage_InitializePage
wiz.ShowDialog()
End Sub
Private Sub MyWizardPage_InitializePage(ByVal sender As Object, ByVal e As InitializePageEventArgs)
e.Chart = DirectCast(e.Control, UserControl1).chartControl1
End Sub
|