Answer the question
In order to leave comments, you need to log in
How to bind View and ViewModel, MVVM Light Toolkit?
Good day.
How to bind a newly created control from View to a collection from ViewModel? Say, as a result of the program execution, a new control is created and it needs to set the content from the ObservableCollection (which is located in the ViewModel). How to organize this connection without violating the MVVM pattern?
Answer the question
In order to leave comments, you need to log in
Let's say your View is some UserControl. Then you can do something like
Inside the ViewModel you have a collection of ItemsFromViewModel elements. Then inside your View
...
<ListView ItemsSource="{Binding ItemsFromViewModel}">
...
SELECT *
FROM table
WHERE (SELECT array_agg((t->>'category_id')::INT) FROM jsonb_array_elements(data->'items') AS t) && ARRAY[1,3,5]
SELECT *
FROM table
WHERE ARRAY(SELECT t.category_id FROM jsonb_to_recordset(data->'items') AS t(category_id INT)) && ARRAY[1,3,5]
SELECT jsv.value#>'{0,name}' as "name" ,jsv.value#>'{0,category_id}' as cat_id
FROM table, jsonb_each(jsonfield) as jsv
WHERE
whoop_whoop_whoop='abc'
and jsv.value#>'{0,name}'='B'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question