caliburn.micro

Visibility Autobinding with naming convention

眉间皱痕 提交于 2019-12-03 16:56:34
问题 I really like Caliburn and the naming convention binding and was surprised that the Visibility is not bound in the same way the "CanNAME" Convention is used to guard an Action. As far as I know is the BooleanToVisibilityConverter only used when Binding is explicitly used in Caliburn and not automatically like the guard method. So I was thinking to modify the source to bind automatically to "bool? ControlNameIsVisible()" (null equals collapse) or similar. I was wondering if that is the right

How to set focus to a control with Caliburn.Micro MVVM

时光总嘲笑我的痴心妄想 提交于 2019-12-03 13:17:23
问题 I have a form and I want to set the focus to a text box when certain user actions happen. I know the MVVM way of doing things is to bind to VM properties, however the TextBox does not have a property that will allow this to happen. What's the best way to set the focus from the VM? 回答1: I have created an IResult implementation that works quite well for achieving this. You can get the view from the ActionExecutionContext of the IResult, which you can then search (I search by name) for the

Navigation with Caliburn Micro

余生长醉 提交于 2019-12-03 11:19:39
问题 I'm playing around with Caliburn.Micro and have a very simple application now. It has an AppView, which actually has a ContentControl for a NavigationBar, an InnerView and a StatusBar. Now I want to handle Navigation between different inner views. Right now I use the eventaggregator to publish a NavigationEvent, which should switch the innerview of the mainwindow to another view. Here is my call to Publish (all InnerViews have the same baseclass which has an IEventAggregator) public void

Caliburn Micro Constructor Injection Failed

假装没事ソ 提交于 2019-12-03 09:24:37
问题 I am learning Caliburn Micro and try to make use of the EventAggregator from the official site. However, I got an exception "No parameterless constructor defined for this object." The message itself is clear but the example doesn't include a parameterless constructor either. If i add one, the constructor with parameter is not hit and the IEventAggregator is still not injected correctly. Here is my publisher VM after adding the parameterless constructor (without it, exception will be thrown):

Caliburn.Micro getting it to bind UserControls in a MainView to their ViewModels

戏子无情 提交于 2019-12-03 09:06:36
问题 I have a MainView.xaml, binding to a MainViewModel just fine. What I wanted to try out was splitting a lot of controls I have on my main form into UserControls. Now I put the UserControls inside the Views folder along with the MainView and named them, LeftSideControlView.xaml and RightSideControlView.xaml. The corresponding ViewModels are in the ViewModels folder called LeftSideControlViewModel, etc. I successfully added the usercontrols to the mainview: <Grid> <Grid.ColumnDefinitions>

Caliburn Micro: DialogResult

女生的网名这么多〃 提交于 2019-12-03 08:36:31
I can't find a solution for the following problem: I open a Dialog with the WindowManager from caliburn micro: public void UserNew() { this._windowManager.ShowDialog(new UserViewModel(this._windowManager)); } Now I need a DialogResult when the user close the dialog with the OK button. The ShowDialog method of WindowManager don't return a DialogResult... Can anyone help me? I tend to use the View Model to handle determining what happened in the dialog. For instance, you can have an IsCancelled property on your UserViewModel that you can interrogate after returning from the ShowDialog call.

How can I bind source MediaCapture to CaptureElement using Caliburn.Micro?

房东的猫 提交于 2019-12-03 08:34:09
On Windows Phone 8.1, I am using the Caliburn.Micro view-model-first approach, but as the view model cannot have any knowledge of the view, I cannot see how I can bind a MediaCapture object to a CaptureElement in the view. I had the same problem. I'm using MVVM Light with Windows Phone 8.1 WinRT (Universal Apps). I used ContentControl and binded to CaptureElement: <ContentControl HorizontalAlignment="Left" Width="320" Height="140" Content="{Binding CaptureElement}"/> CaptureElement and MediaCapture are properties in my ViewModel: private MediaCapture _mediaCapture; public MediaCapture

WPF Caliburn.Micro/mvvm Navigation

不打扰是莪最后的温柔 提交于 2019-12-03 08:30:44
I'm building a project, and one of the biggest problems I've come across until now is navigation. I've been looking for some time now for examples of caliburn.micro/mvvm navigation, but they all seem to be really long and I couldn't really understand much of it (beginner here!). Some info about my project: I want there to be an outer window/shell, with menu links/tabs that open pages according to the button clicked inside an inner part of the shell, and be able to open change the page from within a one. I currently have: ShellViewModel.cs, MainViewModel.cs, my models, and my views. For now,

Visibility Autobinding with naming convention

爱⌒轻易说出口 提交于 2019-12-03 05:09:57
I really like Caliburn and the naming convention binding and was surprised that the Visibility is not bound in the same way the "CanNAME" Convention is used to guard an Action. As far as I know is the BooleanToVisibilityConverter only used when Binding is explicitly used in Caliburn and not automatically like the guard method. So I was thinking to modify the source to bind automatically to "bool? ControlNameIsVisible()" (null equals collapse) or similar. I was wondering if that is the right approach and if soo if somebody has done the implementation already and could share it here. You could

How to set focus to a control with Caliburn.Micro MVVM

天大地大妈咪最大 提交于 2019-12-03 03:18:01
I have a form and I want to set the focus to a text box when certain user actions happen. I know the MVVM way of doing things is to bind to VM properties, however the TextBox does not have a property that will allow this to happen. What's the best way to set the focus from the VM? I have created an IResult implementation that works quite well for achieving this. You can get the view from the ActionExecutionContext of the IResult, which you can then search (I search by name) for the control you want to focus. public class GiveFocusByName : ResultBase { public GiveFocusByName(string