caliburn.micro

Autofac and Func factories

女生的网名这么多〃 提交于 2019-11-30 04:50:22
I'm working on an application using Caliburn.Micro and Autofac. In my composition root I'm now facing a problem with Autofac: I have to inject the globally used IEventAggregator into my FirstViewModel, and a second IEventAggregator that has to be used only by this FirstViewModel and it's children. My idea was to make the second one be injected as Owned<IEA> , and it works, the container provides a different instance of IEA. public FirstViewModel( IEventAggregator globalEA, IEventAggregator localEA, Func<IEventAggregator, SecondViewModel> secVMFactory) {} The problem comes when I have to

Reactive Extensions for .NET (Rx) in WPF - MVVM

馋奶兔 提交于 2019-11-30 02:09:46
I am using Reactive extensions for NET (Rx) with Caliburn.Micro in my WPF app. I'm trying to port my WPF app to use an MVVM architecture and I need to monitor changes in the Text property of a TextBox control. If the last change of the Text property was more than 3 seconds ago I need to call the LoadUser method of a service. Porting the logic from my old solution to the new solution with MVVM architecture. OLD XAML: <TextBox Name="Nick" Grid.Row="0" FontSize="14" Margin="2,2,2,2" HorizontalAlignment="Stretch" TextChanged="Nick_TextChanged" /> In code behind I have this: ... Observable

Caliburn Micro 'Enter' Key Event

。_饼干妹妹 提交于 2019-11-30 01:12:39
I am attempting to bind an event with Caliburn Micro and I am having some issues getting the right messages to the method. I would like to add the ability to press the 'Enter' key after changing the value in a text box and it execute the same method that the button next to is bound to. However, regardless of which key is pressed, I get the following exceptions: A first chance exception of type 'System.InvalidCastException' occurred in MyApp.exe A first chance exception of type 'System.Reflection.TargetInvocationException' occurred in mscorlib.dll A first chance exception of type 'System

Different View depending on ContentControl (Caliburn.Micro)

两盒软妹~` 提交于 2019-11-30 00:06:45
I'm binding ViewModels to ContentControls and letting Caliburn taking care of creating and binding the view. However, I would like to customize Caliburns ViewModel->View convention based on which ContentControl I'm binding to. For example, a regular ContentControl, I want the regular View to bind (SomethingViewModel -> SomethingView). But for a certain ContentControl, I want Caliburn to fetch a View named for example SomethingViewSpecial. Is that possible? Yes, it is possible. Use cal:View.Context attached property and then name your view for the specified context like YourNamespace.Something

Add multiple views inside a view using WPF and Caliburn.Micro

让人想犯罪 __ 提交于 2019-11-29 23:14:09
I'm trying to learn using Caliburn.Micro with WPF. How can I add multiple views inside a view? <Window x:Class="ProjectName.Views.MainView" ...> <Grid> <views:MyControlView /> </Grid> </Window> Another view, with viewmodel: MyControlViewModel <UserControl x:Class="ProjectName.Views.MyControlView" ...> <Grid> ... </Grid> </UserControl> If i just add the view, it won't detect that it has a viewmodel with the appropriate name. How can i bind this to it? I have tried out with different bootstrappers and using something like cal:Bind.Model="path/classname/merge of the two". Have tried to add that

Caliburn.Micro. Automatically call eventaggregator.Subscribe() for IHandle implementors with Autofac

爷,独闯天下 提交于 2019-11-29 19:37:19
问题 In Caliburn.Micro documentation the authors mention such possibility: documentation link IHandle inherits from a marker interface IHandle. This allows the use of casting to determine if an object instance subscribes to any events. This enables simple auto-subscribing if you integrate with an IoC container. Most IoC containers (including the SimpleContainer) provide a hook for being called when a new instance is created. Simply wire for your container’s callback, inspect the instance being

Silverlight + MVVM + Bindings = Memory leaks?

这一生的挚爱 提交于 2019-11-29 18:36:32
问题 Thus far, my testing has shown that all standard approaches, examples, and frameworks leveraging the MVVM pattern in silverlight suffer from a huge problem: massive memory leaks which prevent VMs from being garbage collected. Obviously this is a huge and ridiculous claim - so my expectation is that someone will have an obvious answer of why and where I'm going wrong :) The steps to reproduce are simple: Bind your viewmodel to a view by setting the views datacontext to the VM (assume the

How can I bind key gestures in Caliburn.Micro?

╄→гoц情女王★ 提交于 2019-11-29 08:24:38
问题 How can I get Caliburn.Micro to map a key gesture to an action method on my ViewModel? For example, I want to implement a tabbed interface, and I want my ShellViewModel to have a NewTab method, which the user should to be able to invoke by pressing Ctrl+T on the keyboard. I know that the full Caliburn framework has support for gestures, but how can I do this using Caliburn.Micro? Is there perhaps some way to bind an action to a RoutedCommand (since RoutedCommands already support input

WPF Context Menus in Caliburn Micro

╄→гoц情女王★ 提交于 2019-11-29 07:17:52
问题 I'm trying to get a context menu within a ListBox ItemTemplate to call a method on the parent view model, passing in the item that was clicked on as a parameter. I have this working for other buttons in the item template, but for the context menu it seems to be failing. I have the following xaml (abbreviated for clarity): <ListBox> <ListBox.GroupStyle> <GroupStyle> ... </GroupStyle> </ListBox.GroupStyle> <ListBox.ItemTemplate> <DataTemplate> <Grid> <Grid.ContextMenu> <ContextMenu Name="cm">

Global handling exception in WPF app with Caliburn.Micro

馋奶兔 提交于 2019-11-29 07:14:56
Hi I try implement solution from this site im my WPF app for global exception handling. http://www.codeproject.com/Articles/90866/Unhandled-Exception-Handler-For-WPF-Applications.aspx I use Caliburn Micro as MVVM framework. Service I have in external assembly and it is injected in view model class with MEF. Here is my implementation for global exception handling in WPF app. App.xaml DispatcherUnhandledException="Application_DispatcherUnhandledException" Startup="Application_Startup" App class: public partial class App : Application { private IMessageBox _msgBox = new MessageBoxes.MessageBoxes(