1

Topic: WPF MVVM reefs

Probably I not so do something where to dig? While the tree of elements statically, all like turns out. But in difficult forms it is necessary it dynamic , and not just at initialization, but also during program operation. It is necessary to hold in ViewModel the link on View. All strongly becomes complicated. To hammer on MVVM,  and to do as in WinForms? It would not be desirable.

2

Re: WPF MVVM reefs

Hello, s_aa, you wrote: And to show a code/xaml not the destiny? _> probably I not so do something where to dig? Probably. From here and to there dig.

3

Re: WPF MVVM reefs

S> And a code/xaml to show not the destiny? A question on architecture, it is is specific with this code at me problems is not present. The publication of the specific code here will be reduced to arguing of curve hands of the author, and a help zero on a specific question.

4

Re: WPF MVVM reefs

Hello, s_aa, you wrote: S>> And a code/xaml to show not the destiny? _> a question on architecture, it is is specific with this code at me problems is not present. The publication of the specific code here will be reduced to arguing of curve hands of the author, and a help zero on a specific question. All there is normal in MVVM. You are is more specific a problem describe

5

Re: WPF MVVM reefs

MM> all there is normal in MVVM. You are is more specific a problem describe Created View, transferred to it as DataContext ViewModel. In a program operating time works Command in ViewModel. It is necessary to rebuild a tree of elements in View. How it to make without having in ViewModel the link on View?

6

Re: WPF MVVM reefs

Hello, s_aa, you wrote: MM>> all there is normal in MVVM. You are is more specific a problem describe _> Created View, transferred to it as DataContext ViewModel. In a program operating time works Command in ViewModel. It is necessary to rebuild a tree of elements in View. How it to make without having in ViewModel the link on View? INotifyPropertyChanged and ObservableCollection to business do not help?

7

Re: WPF MVVM reefs

Hello, s_aa, you wrote: _> works Command in ViewModel. To rebuild a tree of elements in View. It is a lot of methods. The idea consists in breaking View (repeating and dynamic parts), each part  corresponding ViewModel, using data template or using special  any element, DataTemplateSelector, DataTrigger in style with substitution ControlTemplate and . _> the Publication of the specific code here will be reduced to arguing of curve hands of the author, and the help zero on a specific question Was experience? Or why so it is not optimistical? All are mistaken. Do not try to hide your code. The fastest method to learn is when someone rectifies your errors. The reason of the bad relation consists in a question more often. On StackOverflow even entered voting that the bad questions  to close because it is the big problem. Your question would be closed as "too broad". Because "the good" answer should tell about all methods and nuances that as a matter of fact pours out in small (or big) article. Or generally as the offtopic because you complain that a certain code does not work, and the code do not show. Show the code,  it is accurate that happens and as you want - and any expert shows you one of optimal for the given conditions the decision. Without the given conditions as you understand, decisions - set.

8

Re: WPF MVVM reefs

Hello, s_aa, you wrote: MM>> all there is normal in MVVM. You are is more specific a problem describe _> Created View, transferred to it as DataContext ViewModel. In a program operating time works Command in ViewModel. It is necessary to rebuild a tree of elements in View. How it to make without having in ViewModel the link on View? The vjushnoe tree should be under construction on the basis of any property inside viewmodel. We update property - the magic image will update also a tree (an INotifyPropertyChanged-machinery round which everyone MVVM turns the hierarchy of base classes).

9

Re: WPF MVVM reefs

MD> Vjushnoe the tree should be under construction on the basis of any property inside viewmodel. We update property - the magic image will update also a tree (an INotifyPropertyChanged-machinery round which everyone MVVM turns the hierarchy of base classes). Thanks . A correction "already existing tree". And if one elements have to be deleted, others to add?

10

Re: WPF MVVM reefs

S> it is a lot of methods. The idea consists in breaking View (repeating and dynamic parts), each part  corresponding ViewModel, using data template or using special  any element, DataTemplateSelector, DataTrigger in style with substitution ControlTemplate and . Which on what thoughts directed, I will think thanks.

11

Re: WPF MVVM reefs

Hello, s_aa, you wrote: S>> it is a lot of methods. The idea consists in breaking View (repeating and dynamic parts), each part  corresponding ViewModel, using data template or using special  any element, DataTemplateSelector, DataTrigger in style with substitution ControlTemplate and . _> Which on what thoughts directed, I will think thanks. Principal 3 things in WPF: 1.  2. As already told data template and DataTemplateSelector 3. value converter it is almost enough of It what to make any interface, sometimes only there is a necessity to add to elements additional properties of dependence. Still I will add that data template can as to contain data template and to use the DataTemplateSelector, i.e. they can be enclosed each other.

12

Re: WPF MVVM reefs

Hello, s_aa, you wrote: MD>> Vjushnoe the tree should be under construction on the basis of any property inside viewmodel. We update property - the magic image will update also a tree (an INotifyPropertyChanged-machinery round which everyone MVVM turns the hierarchy of base classes). _> Thanks . A correction "already existing tree". And if one elements have to be deleted, others to add? It TemplateSelector' dares

13

Re: WPF MVVM reefs

Hello, s_aa, you wrote: _> Thanks . A correction "already existing tree". And if one elements have to be deleted, others to add? And what difference? Or you also create it too pens in ? So it mvvm never. 1) it is done  at ,  contains necessary hierarchy of elements (probably, too , proceeding from the task) 2) Vjuha  to it . And how  will visualize a content - ours  it is deeply violet. How many and what such   on it  - ours  too it is deep . Everyone  displays  how wants. It can be a tree, or  for elements only top level, or is simple , displaying total number of elements in this hierarchy, or the maximum depth of hierarchy, etc.

14

Re: WPF MVVM reefs

You not about that. But thanks for the answer, already suggested an idea.

15

Re: WPF MVVM reefs

Hello, s_aa, you wrote: _> You not about that. But thanks for the answer, already suggested an idea. Both its answers are true and concern your problem.... <<RSDN@Home 1.3.110 alpha 5 rev. 62>>

16

Re: WPF MVVM reefs

Hello, s_aa, you wrote: _> to Hammer on MVVM,  and to do as in WinForms? It would not be desirable. And what you have such superuseful, dancing round imposed to you MVVM?

17

Re: WPF MVVM reefs

K> And what you have such superuseful, dancing round imposed to you MVVM? Beautiful technology, esthetic pleasure I receive

18

Re: WPF MVVM reefs

K> And what you have such superuseful, dancing round imposed to you MVVM? The salary? Possibility to work in a command and in the project where MVVM use?

19

Re: WPF MVVM reefs

Hello, s_aa, you wrote: 1) you Use library MVVMLight 2) you Inherit the ViewModel from ViewModelBase 3) In properties which  it is caused function RaisePropertyChanged () 4) As commands you use RelayCommand from name space GalaSoft. MvvmLight. Wpf 5) the Collection of objects you place in ObservableCollection 6) This collection you initialize ListCollectionView which  to ItemsSource. For update you cause function Refresh. 7) For tree elements it is possible to create separately object hierarchy where the basic is inherited from ViewModelBase. In the same place it is possible to add such properties such as, for example, IsExpanded which will be  to ItemContainerStyle.