caliburn.micro

How to pass parameter to navigated view model with WinRT Caliburn.Micro?

六月ゝ 毕业季﹏ 提交于 2019-11-29 02:30:57
I am developing a Windows Store apps game using WinRT Caliburn.Micro , and I am relying on the navigation framework. I have view models for the game setup (define players) and the actual game. When navigating from the setup to the game, I want to pass the collection of players to the game view model. How can I do this? Schematically, my view models currently look like this: public class SetupGameViewModel : NavigationViewModelBase { public SetupGameViewModel(INavigationService ns) : base(ns) { } public IObservableCollection<Player> Players { get; set; } public void StartGame() { // This is as

Autofac and Func factories

谁说胖子不能爱 提交于 2019-11-29 01:58:21
问题 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

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

冷暖自知 提交于 2019-11-28 23:05:23
问题 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"

“No target found for method” thrown by Caliburn Message.Attach()

僤鯓⒐⒋嵵緔 提交于 2019-11-28 09:26:21
I have a list box for which I am styling ItemContainer to include a context menu. Here is the xaml for the same. <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> ... <Setter Property="ContextMenu"> <Setter.Value> <ContextMenu> <MenuItem Header="Remove Group" cal:Message.Attach="DeleteGroup"/> </ContextMenu> </Setter.Value> </Setter> </Style> I have coded the target method in ViewModel as given below. public void DeleteGroup() { //ToDo ... } The ViewModel is set as the DataContext of the UserControl in which there is the ListBox. The above code results in "no target found

How do I load controls in different ContentControls of a Shell using CaliburnMicro

百般思念 提交于 2019-11-28 00:48:29
问题 By default when you use "ActivateItem(new Control());" your control is loaded into a ContentControl which with the name ActiveItem, fro example. . If I have multiple content controls on my page how would I load controls into them whilst retaining the ability to use the default functionality of being able to load controls into the the active item control. for example I want to have a login control to be loaded into the Login ContentControl, and when a user successfully login I want a new

Adding a convention for IsEnabled to Caliburn.Micro

谁说胖子不能爱 提交于 2019-11-27 21:39:37
How do I add a custom convention to Caliburn.Micro for the IsEnabled property of controls - something like having NameEnabled bound to IsEnabled in parallel to Name bound to Text on a TextBox. In a way, what I want to achieve is similar to the way that a CanSave property can be used to enable/disable a button bound to a Save method, but generic for all controls. Caliburn.Micro right now ( 1.3.1 ) doesn't really support this "multiple" conventions for the same FrameworkElement , what you have described. EDIT : However you can hook into the ViewModelBinder.BindProperties method and there you can

using attached events with caliburn micro Message.Attach

故事扮演 提交于 2019-11-27 20:42:34
I'm trying to use caliburn micro message to trigger an attached event that I created: public static class DataChanging { public delegate void DataChangingEventHandler(object sender, DataChangingEventArgs e); public static readonly RoutedEvent ChangingEvent = EventManager.RegisterRoutedEvent("Changing", RoutingStrategy.Bubble, typeof(DataChangingEventHandler), typeof(DataChanging)); public static void AddChangingHandler(DependencyObject o, DataChangingEventHandler handler) { ((UIElement)o).AddHandler(DataChanging.ChangingEvent, handler); } public static void RemoveChangingHandler

How to close dialog window from viewmodel (Caliburn+WPF)?

╄→尐↘猪︶ㄣ 提交于 2019-11-27 20:35:46
I have ViewModel1 and View1 associated with it. I start dialog window from ViewModel2 (some another viewmodel) using IWindowManager object. The code from ViewModel2 class: windowManager.ShowDialog(new ViewModel()); So, I have Dialog Window with View1 user control. My answer is next - I can close that dialog window using red close button, but how to close it using my specific button (contained in View1 user control), something like "Cancel" button with close command ( Command={Binding CancelCommand} ), CancelCommand of course is contained in ViewModel1 class. It's even easier if your view model

How to pass parameter to navigated view model with WinRT Caliburn.Micro?

我的未来我决定 提交于 2019-11-27 16:51:43
问题 I am developing a Windows Store apps game using WinRT Caliburn.Micro , and I am relying on the navigation framework. I have view models for the game setup (define players) and the actual game. When navigating from the setup to the game, I want to pass the collection of players to the game view model. How can I do this? Schematically, my view models currently look like this: public class SetupGameViewModel : NavigationViewModelBase { public SetupGameViewModel(INavigationService ns) : base(ns)

Caliburn Micro and ModernUI Examples/Tutorials

廉价感情. 提交于 2019-11-27 11:43:48
问题 does anyone have an example or tutorial on how to use Caliburn Micro together with ModernUi (https://mui.codeplex.com)? 回答1: Ok so I had a quick mess about with it and a look on the Mui forums and this seems to be the best approach: Since the window loads content from URLs you need to take a view-first approach, and then locate the appropriate VM and bind the two. The best way to do this appears to be via the ContentLoader class which is used to load the content into the ModernWindow when it