March 17th, 2009, 04:21 AM
WPF Control Content overwite at startup
I am new to the world of WPF - so not sure how to do the below functionality. It will be great if someone can help me.
I have developed an app using WPF (XAML). What I am trying to do is during the start up time of the app, I am trying to read a file (.txt and xml) and I am trying to load the content for the controls from there. Those names will overwrite the default names for the controls given in the xaml files. I am loading the default names in xaml file from a resx file.
For example, one control is the name of the. In resx file, I stored "default user". Now every user should be able to display there name by simple adding a pre-defined tag "My_Name" and then providing there name in a .txt file. The app, on strat up, should load that string from the .txt file.
I found out a way to do it in the code - by reading the string from the file and assiging thet Control.Content = "Name_Read_From_File" - but I am trying to do it at the strat-up time by parsing the xaml file directly - so that I can restrict the functionality in one place. Many thanks in advance...
April 20th, 2009, 08:15 AM
Re: WPF Control Content overwite at startup
Do you want to put a "placeholder" kindof thing in the xaml?
If this is what you want, then there is a way.
In the xaml file, do somthing like this
and in the codebehind at start up,
do this way: Based on the logic, show the appropriate value.
I hope this is what you expect.
Last edited by MMH; April 20th, 2009 at 08:17 AM.
my post if you find it usefull.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.