caliburn.micro

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

孤街醉人 提交于 2019-12-06 03:41:31
问题 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

Binding nested ItemsControls to nested collections

ⅰ亾dé卋堺 提交于 2019-12-06 03:20:17
I am trying to show pages in my WPF/Caliburn Micro application. The pages should be presented in a rectangular way to the user. My idea is to use a collection (the rows) of collections (the columns) of my base view model for the pages: public BindableCollection<BindableCollection<BaseViewModel>> Children { get; set; } And do something like this in the associated View: <ItemsControl x:Name="Children"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Vertical" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <ItemsControl

Dialog view containing two Caliburn.Micro views?

不羁的心 提交于 2019-12-06 00:50:20
I have a Windows WPF app in which I'm using Caliburn.Micro. The main window view/viewmodel is handled by Caliburn.Micro. One of it's buttons pops up a new dialog window which uses a different view-viewmodel. In this dialog I have a container (list box and some filter controls) that I want to make into a reusable control so that I can include it in other dialogs. To do this I extracted from the dialog's view and viewmodel the relevant code and created a new view and viewmodel. This all looks good. The problem is that now back in the dialog I have a dockpanel with a big empty space where I need

Caliburn micro in no Application object mode, like in AutoCAD dll plugin

痞子三分冷 提交于 2019-12-05 22:53:47
I am using Caliburn Micro to develop WPF application. A few of views of this application needs to be loaded in an AutoCAD environment. The AutoCAD programming environment allows developement of AutoCAD plugins (of type dll) and load them into the AutoCAD environment. Because of AutoCAD plugin type(dll), the plugin does not have an Application Object, so the bootstrapper has to be customized for that. According to the Caliburn Micro documentation here (Scroll down to "Using Caliburn.Micro in Office and WinForms Applications") we can inherit the non-generic bootstrapper and pass "false" to the

How do you bind to a command property with caliburn.micro?

主宰稳场 提交于 2019-12-05 21:05:12
I have a behavior that exposes several command properties. Typically I use MVVM Light and would just use a routed command in my view model and bind to those. However, this project is using Caliburn.Micro so I'm trying to do it the Caliburn.Micro way. Is there some syntax I can use on the Message.Attach to do this (is there any good documentation on the parser for Message.Attach)? Do I have to modify the behavior to expose events to make this work with Caliburn.Micro? Caliburn.Micro has its own mechanism for view/viewmodel communication as an alternative to commanding called Actions . You

WPF Caliburn Micro CanExecute when property of binded object changes

天大地大妈咪最大 提交于 2019-12-05 20:52:52
I have the problem, that my CanSave method doesn't get called, when I change a binded property. View The View contains of some Labels and TextBoxes ... nothing special... The TextBoxes are binded to the properties of an object. <Label Target="{Binding ElementName=txtTitle}" Grid.Column="0" Grid.Row="0" Content="Titel" Foreground="White" /> <TextBox Name="txtTitle" Grid.Column="1" Grid.Row="0" Text="{Binding NewBook.Title}" /> <Label Target="{Binding ElementName=txtAuthor}" Grid.Column="0" Grid.Row="1" Content="Autor" Foreground="White" /> <TextBox Name="txtAuthor" Grid.Column="1" Grid.Row="1"

Why does binding affect height?

半城伤御伤魂 提交于 2019-12-05 19:05:36
Style definition in Resources/Shared.xaml ( updated ): <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib"> <system:Double x:Key="fullHeight" >26</system:Double> <system:Double x:Key="halfHeight" >16</system:Double> <Thickness x:Key="m">10</Thickness> <Style TargetType="Button"> <Setter Property="FontSize" Value="{StaticResource fullHeight}"/> <Setter Property="Margin" Value="{StaticResource m}"/> <Setter Property="Padding" Value="10"/> </Style> <Style

In Caliburn.Micro how to bind action to nested ViewModel method?

北城余情 提交于 2019-12-05 12:19:43
I have a WPF application, powered by Caliburn.Micro, view-model first approach. There's a command-bar type of control with its CommandBarView.xaml and bound CommandBarViewModel . Command-bar VM holds a number of nested VMs, one for each button control, all showing a common interface and having common behaviour. Command-bar VM expose them so they can be bound from view: public interface IWarningButtonViewModel { bool IsVisible { get; } bool CanShowWarning { get; } void ShowWarning(); } public class CommandBarViewModel : PropertyChangedBase { public IWarningButtonViewModel UserNotFoundWarning {

(Caliburn Micro) Mapping a ActionMessage Methodname to a Child Object of the ViewModel

ⅰ亾dé卋堺 提交于 2019-12-05 11:55:48
I would like to bind the methodname propererty of the caliburn.micro actionmessage to a method on a child object of the ViewModel. How I would imagine it should work: <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <cal:ActionMessage MethodName="MenuItemX.Clicked" /> </i:EventTrigger> </i:Interaction.Triggers> The problem here is that the methodname does not live directly on the viewmodel, but on a childobject of the viewmodel. So in this case I would like to bind to: ViewModel.MenuItemX.Clicked() Current workaround is having a pass-through method on my viewmodel which smells. You

Filling and binding two combobox WPF Caliburn.micro

China☆狼群 提交于 2019-12-05 09:16:46
I have this table: I use in my project this view Called NewItem and in this view there is two combobox. I would like to do this : that in the combobox Group there are all DESCRIPTION of table GROUP, and when i choose an item of this description (of first combobox) the second combobox fills of descriptions relating only to that description that I have chosen before. This is some code: XAML NewItemView: <ComboBox Height="21" HorizontalAlignment="Left" Margin="89,99,0,0" VerticalAlignment="Top" Width="106" x:Name="Group" SelectedItem="{Binding SelectedGroup}" /> The ViewModel code is like: