WPF, MVVM and Prism modularity -


i still learning use mvvm , prism , have general questions:

  • i have grid in view. lets have button when click want auto size grid columns. code go? resizing grid columns view thing , view model shouldn't know it. in case adding button click handler in view's code behind? have same question grid editing , validation. view model can see when value edited two-way binding if decides value invalid, how can notify grid cancel edit?

  • lets view has number of user controls , each user control needs bind data different object. view model view huge class of data need of different components of view?

  • regarding prism , modular design, trying figure out "module" is. understanding module self contained, meaning if pick module , drop in app, should work. if have class makes service calls (lets soap calls server info) , populates grid, module need include both mvvm components , service layer, right? if have multiple modules use same service layer, each 1 need include copy of service layer classes in order considered complete module?

thanks advice/info.

i'll try go on these items separately.

  1. as said, resizing grid columns more of view thing, keeping part of ui logic best thing. intention of keeping code behind clean possible, can use different things such behaviors , in scenarios routed commands avoid having code-behind filled code. validation logic, should place in vm/m , use wpf's validation capabilities (such idataerrorinfo , others).
  2. you can have single view model user controls or take hierarchichal view model approach. latest prism drop, shows scenario in mvvm ri.
  3. your understanding of modules accurate. 1 thing consider, if have common service entire application, usual approach placing interface in infrastructure project , reference when necessarry (the concrete implementation obtained via di or mef imports). module concrete implementation belongs can choose register service in container/expose export required. this thread has more information modules, are, , how should used.

if getting started prism , have other questions, might find codeplex forum useful, perhaps question has been answered there prism se team.

i hope answer helps.

thanks, damian


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -