WPF: Binding with nonstatic parameter? (newbie question) -


This may be obvious but I can not find the best method.

I have to show that the user's ToDo is in a listback, they are in the Tudo database and include an ID, User ID and details.

The user has logged into the app.

How can I get Todo for that specific user ID and set it to compute in the list?

I was trying with an ObjectDataProvider but I can not understand how to use it in combination with nonstatic stuff (eg my _dbService, userId, language, ...).

What are the only options for stabilizing all those versus versus versus codes?

If so, it means that ObjectDataProvider is not very useful, is not it? I am being used with very strict parameters, but in any situation where I need such functionality, there are hardly any.

I do all my WPF using patterns I have given you a link but Google will load you MVVM is a standard pattern for WPF. The more complex you are, the better it is written and brings home the use of MVVM.

Actually, you make a model of your data. In this case, you can probably create a simple class with property ID, user ID and description (I will call it tudoitum). Use your favorite mechanism to obtain a collection of these from the database. SQL, the Entity Framework, a standard question, whatever.

Then you have your view modal - for each example of the model you have an example of ViewModel: see M and 'Next properties in VM that you use to manipulate the model Are there.

Then you have your view - this is UI, you set up DataContext to see ViewModel, and then your bindings are automatically added to ViewModel. Your view just ends the things you can see that all the work is done in the model, this means that it is very easy to test.

Therefore, when you click on a button in your view, the binding is done at a command in your view modal which manages the model.

The UI is also a view with a View Module, therefore, your UI can load a collection of models from the VM database and leave them in an Observeable Collection list box item collection for this Observeable Collection Will be bound.

It is difficult to explain all this in a post like this. Read some articles and see what you think. I am still quite new on this, but I believe that my studies about MVVM have ceased.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -