prism

Splitting app's parts in their own assemblies when using Prism

自古美人都是妖i 提交于 2019-12-24 00:24:03
问题 The MVVM approach encourages (or just gives the possibility to) splitting a WPF or Silverlight application into Model , ViewModel and View projects so all three could exist in their own assemblies. Using Prism (and, in my case, MEF as a Dependency Injection Container), on the other hand, one can build a modular application that is divided into a set of functional units (named modules) and each unit, in this case, is a seperate assembly. Am I right that in this case we can separate only a

How to automate the creation of WPF Viewmodel properties

↘锁芯ラ 提交于 2019-12-24 00:13:22
问题 I am using Visual Studio '17 and Resharper in a WPF project that displays a lot of information to the user. Therefore I have a lot of properties that look like the following. private double _foo; public double Foo { get { return _foo; } set { SetProperty(ref _foo, value); } } I'm looking for a quick automated way to create this. Right now I type 'prop' and get this public double Foo {get; set;} hit 'Alt-Enter' -> 'To property with backing field' to get this private double _foo; public double

g.i.cs files missing, classes no longer contain a definition for InitializeComponent

▼魔方 西西 提交于 2019-12-23 19:43:40
问题 I've been developing a UWP project in my spare time to get a hang of UWP, MVVM and Prism. The project was originally really classic, with no use of MVVM and Prism, and I've been working to get those 2 into the project. I've been relying on https://msdn.microsoft.com/en-us/library/gg405484(v=pandp.40).aspx, https://msdn.microsoft.com/en-us/library/gg405494(v=pandp.40).aspx and https://msdn.microsoft.com/en-us/library/ff921098(v=pandp.40).aspx to work my way through it. Some background: I

Using Silverlight MVVM with Prism/Unity, and need to detect when view is closed

独自空忆成欢 提交于 2019-12-23 15:15:52
问题 I am writing an app using the MVVM (Model-View-ViewModel) pattern and am leveraging the Prism and Unity bits from the Microsoft P&P team. I have a View with a list of items. These items are contained with an ObservableCollection in the ViewModel to which a listbox in the View is databound (the ViewModel is set as the DataContext of the View). In the ViewModel, I have a timer running that fires a poll of the server for new data every 30 seconds. When the data returns I marshal it over to the

What's the difference between the two RegisterViewWithRegion overloads in Prism

江枫思渺然 提交于 2019-12-23 12:14:42
问题 I'm using Prism4 and in one of my modules I'm trying to register a view with a region and also handle its button clicked event (which is published when user clicks on a button on the view). public class MyModule : IModule { private readonly IUnityContainer container; private readonly IRegionManager regionManager; private readonly IEventAggregator eventAggregator; public MyModule(IUnityContainer container, IRegionManager regionManager, IEventAggregator eventAggregator) { this.container =

C# - Prism for WPF - Common modules' libraries upgrading strategy

丶灬走出姿态 提交于 2019-12-23 05:17:26
问题 I'm designing a composite WPF/MVVM application using Prism patterns. I've read the Developer's Guide to Microsoft Prism Library 5.0 for WPF and I am familiar with most of the patterns described. My application's modules will consist of a number of binaries (dll-s) and some of them will include a shared library , which will define public interfaces to MVVM models, event classes for event aggregator and services implemented by that module. Other modules would be able to reference such a library

MVVM way to wire up event handlers in Silverlight

百般思念 提交于 2019-12-23 04:36:06
问题 Using an MVVM pattern in Silverlight/WPF, how do you wire up event handers? I'm trying to bind the XAML Click property to a delegate in the view model, but can't get it to work. In other words, I want to replace this: <Button Content="Test Click" Click="Button_Click" /> where Button_Click is: private void Button_Click(object sender, RoutedEventArgs e) { // ... } with this: <Button Content="Test Click" Click="{Binding ViewModel.HandleClick}" /> where HandleClick is the handler. Attempting this

Using Prism 6 Event Aggregator between view models with an object as the payload

孤人 提交于 2019-12-23 03:46:10
问题 Hi I'm hoping one of you could help me with some syntax. So I'm following this example https://www.codeproject.com/Tips/591221/Simple-EventAggregator-in-WPF-PRISM on using Prism Event Aggregator to send messages from one ViewModel to another. The following code works great when publishing a single string as the payload. internal class OrderSelectedEvent_SS : PubSubEvent<string> { private static readonly EventAggregator _eventAggregator; private static readonly OrderSelectedEvent_SS _event;

Load Module Default Views In Region to Create Menu

走远了吗. 提交于 2019-12-23 03:17:27
问题 I am builng an M-V-VM application with Dynamic Loading of modules at runtime. Each of these Modules has a default view which individulally they show on the selected region when I go _regionManager.Regions["BottomMenuRegion"].Add( Container.Resolve<AdminModuleView>(), "AdminView", true); However, When the Next Module loads it overwrtites the previous loaded view.. How can I load more than one view into a region so that it creates a "Menu" displaying the default view? e.g <ItemsControl cal

How to make the CanExecute trigger properly using Prism 6

无人久伴 提交于 2019-12-23 01:43:38
问题 I have a Model public class Irritant : BindableBase { private short _id; private string _name; private string _description; public short Id { get { return _id; } set { SetProperty(ref _id, value); } } public string Name { get { return _name; } set { SetProperty(ref _name, value); } } public string Description { get { return _description; } set { SetProperty(ref _description, value); } } public Irritant() { Id = 0; Name = ""; Description = ""; } } Then my ViewModel with two versions public