although I have a concrete case that I want to solve this is a more generic question.
I have a text template that creates a C# file. The text template loads an xml which is also included in the project. Currently anytime I edit the xml and save it, I have to go to the text template and also save it to update my C# file.
In the project the settings are for the C# file that it is the text template, but I guess that this is only a reference to display the items correctly in the Solution Explorer. If I now edit the project file and put also a to the text template to depend upon the XML file, it get the correct structure.
The only problem is, that if I save the XML, the text template is not automatically triggered. So the question is, if there is a possibility to link the items so that I get cascaded updates, so that I only have to modify the XML and the rest is updated accordingly?
This is now my special case, but in the end the question is, if there is a possibility in general?
Thanks
Martin
Related
We are importing form, from existing project to our new project.
It works well in run time, but we can't see controls to modify them in design mode!
Do you know how what we do to see them?
i found it, when i add exist form to my project, in addition add formX.cs, also add another along files (designer and res). thats enough add formX.cs .
I want to bind an ObservableCollection to an XML file. Before the multiple replies of
You should bind your DataGrid, ComboBox, etc.. directly to the XML file
Please note that the ObservableCollection already exists and is already being bound to DataGrid, ComboBox etc... Re-writing all that code doesn't sound like fun at all to me. Although every search I do about binding an XML file to a ObservableCollection returns binding object directly the XML file.
Yes I know I could manually do the add, update, and delete myself but was hoping to not have to do that.
manually do the add, update, and delete myself
Please don't delete yourself. ;-)
Xml node processing is a complex process and does not easily lend itself to such a scenario as adding and deleting from a string list which is what the question is patterning itself off of....
At some point code is needed as a go between, the visual and storage, to facilitate the process of managing the xml structure as adds and deletes are done.
Microsoft Blend has support for binding straight to XML. Perhaps you could add some design time data to the form in Blend, and see what it generates. It might give you some ideas.
I have a web services application where I would like the users to be able to define print page templates with database field placeholder in my project.for this reason I
have to provide environment for design template for my users.this templates must save in database,
then for print I get data from database and put it in placeholders.I found that "XSLT" can be usefully for this issue, but a big problem is Html result for XSLT.If There is any solution please let me know.
thanks in advance
what you can do is: create a html file template, create field placeholder in it. When you need to print it, load data from database, replace the placeholder, create the html file, load it into webbrowser class (it does not have to have an UI). then print from there.
since it is html file, you can save it to database too.
it works great in one of our project which has the same requirement.
I have a lot of forms in my app, and they all need to be translated. Solution is pretty simple with resx files. But also I need to translate messagebox texts, and texts that are displayed in buttons accoroding to current action. I have tried to add string in my *.de.resx file in VS2010, but it disappears after switching form language.
Then I found a solution to store text in hidden labels, but this looks very ugly. Is there a way to add strings to resx without hidden labels?
You probably need to just add a standalone resx to your project (Add, New Item, Resources File). A form resx isn't a safe place to store your non-ui data, as it's autogenerated, and, as you've found, it can delete your alterations when it's regenerated.
The program I am writing is simple. There is an XML source file-the users need a GUI for changing the details and they need the ability to edit the XML file also. So the program will have two tabs-one is a GUI and the other an XML editor. If the user changes something in the GUI it has to be reflected in the XML editor and if the XML in the XML editor is changed it has to be reflected in the GUI too.
I used XSD.exe to generate the classes for the XML and tried serialization and deserialization on tab changed event. Though it works I am finding the lag(becasue of serilaization/deserialization) while changing the tab a little annoying. Is there a better way to do this?
If it were me I would start by using an XmlDocument or an XDocument as the data source for your object model used by the GUI.
Here's a similar question with a great answer showing this type of concept.
Creating a WPF editor for XML file based on schema
You'll still have to handle the tab/view switching to save the xml file or reload it. But with the data binding a lot of the work is done for you once you setup your object model.