views:

295

answers:

1

Hi evryone,

I am pretty new to WPF and I cannot figure out how to update a specific part of my page with a single button click.

In my application design I have a menu with buttons to the left and to the right I have a series of panels. One is status bar (bottom), one Info bar(top) and inbetween I want to visualize the info that the program shows.

I use a stack panel there and I assign a name to it:

Still I cannot properly handle the call that a button should do in order to change the content of the panel. I have read that maybe the key is in creating custom controls (1 for my add form, then for the search form and so on) yet I am not sure that this is the best thing I can do.

The other option I have read about is using a Frame (even though it's a desktop application. Yet I am afraid that this may lead to future problems when I start calling for info from the database.

Please, Advice me on what to do.

+1  A: 

Sounds like you are missing some of the fundamentals of WPF, utimately you should not have to force an update to the UI. You need to bind the controls on the form to a data object and change the values within the data object, the UI will update when the data values have been changed.

You should read up on INotifyPropertyChanged and Data binding / Data context within WPF.

Try this page to get you started: http://blogs.msdn.com/wpfsdk/archive/2006/10/19/wpf-basic-data-binding-faq.aspx

benPearce
Thanks, I will read the page suggested.
Branimir
After some fays of reading - everything is fine now. I use tabs in my case, as MVC would be an overkill for the size of the project. Still this link helped a lot.
Branimir