Click here to Skip to main content
15,918,108 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to rewrite a huge old MFC/C++ project using C# /WPF.
In this project we support scripting language something that we developed here in C/C++
The scripting(text files) allows the user to do many things also allows create a dialog with basic UI elements. Internally it creates a MFC Dialog.
How can I do this using WPF and XAML ?
It is simple to load a XAML Script that creates the dialog how ever say I want to carry out some processing using the values in the dialog.
How can I achieve that?
Say for instance I have a simple WPF application that loads a script. ( This is just an example)
Job of the script is to show a simple dialog box with 2 float numbers in text boxes.
Then I have 4 radio buttons that show the operation Add / Subtract / Multiply and Divide.
And a Calculate button. When user presses the calculate button It should show the result in a message box carrying out the right operation between the numbers.
All the above should be done through only script.
And a OK button that closes the dialog, however when he closes the dialog I want to retain values from the dialog into some sort of Data Structure.
Any help in this regard is greatly Appreciated.
Thanks a bunch in Advance.
Posted

There is no such notion as "XAML script", to best of my knowledge.

To better understand what it is, go to the basics: http://en.wikipedia.org/wiki/XAML[^].

Of course you can use XAML to dynamically create some controls or windows, but it does not resemble scripting which is mostly oriented to imperative programming while XAML is pretty much all declarative. If what you had before was already based on scripting system, I'm not sure XAML can fit your needs.

You can implement any type of scripting language on XML, of course.

You can create a data model of your language (even imperative) and develop some engine which would execute the instance of the schema semantically. Any further discussion should involve more or less full specification of your functional requirements (its important to isolate those ultimate requirement from your technological views to avoid preoccupation with the imprinted solutions). Unfortunately it seems to be somewhat beyond the format of our quick Questions-and-Answers.

—SA
 
Share this answer
 
Instead of Scripting of XAML (which is not effective as you are talking), you can write your Dialog as a Control Library in .NET (using XAML of-course) and build it as Assembly (Dll). Later load the Assembly from your application. Here the Dll will be your scripting file.

.NET has very flexible library to handle an Assembly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900