Is there a way to parse XAML to convert to Chart Controls?

Created at 30 May 2022, 23:55
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
Waxy's avatar

Waxy

Joined 12.05.2015

Is there a way to parse XAML to convert to Chart Controls?
30 May 2022, 23:55


Since these chart controls are based on WPF, I guess there could be a way to parse a xaml file and use these objects, it would be something like this, but for cTrader
 

            var fs = new FileStream("C:\\MyUserPath\\MyLayout.xaml", FileMode.Open);

            System.Windows.Controls.Grid grid = (System.Windows.Controls.Grid)XamlReader.Load(fs);

            System.Windows.Controls.Button buttonFromFile = LogicalTreeHelper.FindLogicalNode(grid, "MyButton") as System.Windows.Controls.Button;


Regards,


@Waxy
Replies

amusleh
31 May 2022, 11:23

Hi,

Controls are not same as WPF controls and you can't serialize them to XML.

If you want to save the state of controls then you can create proxy classes with control properties, then use those classes to serialize the controls state.


@amusleh