caliburn.micro

Will caliburn.micro do the right thing with async method on ViewModel?

核能气质少年 提交于 2019-12-04 09:55:05
问题 As mentioned elsewhere, the new .NET async/await model propagates through layers of software like a virus. A recent async change has now bubbled up to my view model, and I am wondering if it is safe change declaration from public void DoStuff() to public async Task DoStuff() ? Thanks! 回答1: The support of asynchronous programming model in Caliburn.Micro is pretty good now. Few things you can do: Use async/await in Action method . Be careful, as action methods are technically event handlers,

How do I set a Window/Application icon in a application set up with Caliburn.Micro

不羁岁月 提交于 2019-12-04 09:03:19
I think I am missing something obvious. But since the main window of my Application is a UserControl that is being launched by protected override void OnStartup(object sender, StartupEventArgs e) { DisplayRootViewFor<MainWindowViewModel>(); } in my bootstrapper how do I set the Icon of the window itself and of the application in the toolbar? XAML based solution : Change your MainWindowView base class from UserControl to Window (both in .xaml and in .xaml.cs), then set your Icon property or any other window-specific properties right in xaml. Code based solution : DisplayRootViewFor<T> takes an

Binding EF4 with Caliburn.Micro: Should I expose my Entity as a property of the ViewModel?

孤者浪人 提交于 2019-12-04 07:38:09
With Caliburn.Micro I'd like to know the pros and cons of exposing an EF4 Entity as a property of the ViewModel (a technique discussed here and here ). This allows me to avoid writing getters and setters for every field (see OneCustomer below). The drawback is I need to write all of the binding statements in XAML (below LastName is not in the ViewModel but does require XAML binding). If I stick to the prescribed technique of filling my ViewModel with properties for each field (as FirstName below) I'll ultimately have to write a ton of extra code just so NotifyOfProperyChange will get called.

Using Caliburn.Micro binding feature on an “inner” user control

此生再无相见时 提交于 2019-12-04 07:28:50
I'm quite new to Caliburn.Micro, so I guess this has a simple answer (or at least I hope it has :)) I have a ViewModel with a property called ConnectedSystem that has a sub-property called Name . In my View, I have the following XAML (excerpt): <StackPanel Orientation="Horizontal"> <Label Content="Name:" /> <TextBlock x:Name="ConnectedSystem_Name" /> </StackPanel> This works just fine, and the name is shown in the TextBlock as expected. However, ConnectedSystem has around 10 properties that should be displayed, and I don't want to copy-paste the XAML above 10 times inside my view. Instead I

Caliburn.Micro: Create and Bind View programmatically

牧云@^-^@ 提交于 2019-12-04 05:59:55
I am currently experimenting with view composition in Caliburn.Micro. I have a working example where I have multiple user control based views injected into my main shell via the "View.Model" attached property route. So far so good. In my application proper I am working with a mixed environment of mainly WinForms, with some WPF, so there is no WPF "shell" for Caliburn to manage. I'd like to be able to create my views on demand and add them to placeholders in my WinForms app. I would like to know how I go about creating a view (which will be a user control containing sub user controls)

how to use DesignInstance with Caliburn.Micro

纵饮孤独 提交于 2019-12-04 04:02:13
问题 I am using Caliburn.Micro I have this WPF View that in design time uses sample data successfully on basic properties like firstname etc but can't won't find the view for properties and collections of complex types <UserControl x:Class="NonRepositoryItems.Reviewer.ReviewerView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas

How to force Image control to close the file that it opens in wpf

给你一囗甜甜゛ 提交于 2019-12-04 03:54:34
问题 I have an image on my wpf page which opens an image file form hard disk. The XAML for defining the image is: <Image Canvas.Left="65" Canvas.Top="5" Width="510" Height="255" Source="{Binding Path=ImageFileName}" /> I am using Caliburn Micro and ImageFileName is updated with the name of file that image control should show. When the image is opend by image control, I need to change the file. But the file is locked by image control and I can not delete or copy any mage over it. How can I force

Caliburn.Micro: Binding Button in a Screen to a command in ScreenConductor

感情迁移 提交于 2019-12-03 21:44:20
I'm following this tutorial on Screen and ScreenConductors in Caliburn.Micro Framework. I'm using WPF, not Silverlight, and I have made the corresponding changes in App.xaml (using MergedDictionary for the Bootstrapper). The original Simple Navigation example has a shell with two buttons, and a content area where two possible screens are displayed, conducted by the ShellViewModel . Then I tried to move each button to its counterpart View, so that PageOne would have a button to take to PageTwo, and vice-versa. I did it because I don't want the home shell continuously "showing its entrails"

EF ComboBox not displaying SelectedItem Binding

你说的曾经没有我的故事 提交于 2019-12-03 21:10:08
问题 I am using Entity Framework and Caliburn.Micro to implement an MVVM application. Basically, I have set up AuthorModel and BookModel in a one to many relationship - an Author having multiple Books and a Book having only a single Author. I have a SelectBookWindow where I use DbContext to load ObservableCollection<Book> , from where I select a Book I want to view/edit. I then pass the selected Book as a parameter to an EditBookWindow where I have a combobox enumerating all the Authors but with

Caliburn Micro -> Composing Views from multiple Views/UserControls/CustomControls

柔情痞子 提交于 2019-12-03 20:38:48
How is it possible to re-use and compose parts in CM managed windows? I have found posts regarding using two UserControls to bind to the same ViewModel, but not so much if I want to have multiple views and viewmodels all composed in the same window. (a viewmodel for each view composed into a "master view") The first part of my question would be how to break up components for re-use? If I have two areas of a window where one is a datagrid and another is a details view with labels and text boxes should these be in separate usercontrols, customcontrols or windows? Each one would ideally be stand