caliburn

Update item in BindableCollection with notify ICollectionView

夙愿已清 提交于 2019-12-11 05:48:45
问题 Hi I bind collection from Caliburn Micro on ListBox control in view. Here is it. public BindableCollection<UserInfo> Friends { get { return _friends; } set { _friends = value; NotifyOfPropertyChange(() => Friends); } } ListBox items is type of UserInfo. Hi I sort and group listbox items, I use CollectioView on this purpose. When I initialize ListBox I sort and group items with this method. private ICollectionView _currentView; //... private void SortContactList() { _currentView =

How to use IsKeyboardFocusWithinChanged action message with caliburn?

浪子不回头ぞ 提交于 2019-12-08 02:43:40
问题 I've noticed sometimes I can not get certain ActionMessages to behave, for example: <TextBox cal:Message.Attach="[Event IsKeyboardFocusWithinChanged] = [Action Foo()]"/> Will never call Foo, I'm forced to use code behind: <TextBox IsKeyboardFocusWithinChanged="Foo"/> 来源: https://stackoverflow.com/questions/20753248/how-to-use-iskeyboardfocuswithinchanged-action-message-with-caliburn

Can I use Caliburn to bind to RoutedCommands?

試著忘記壹切 提交于 2019-12-05 19:55:29
What's the best way to use WPF's built-in RoutedCommands with Caliburn ? For example, in my shell I have an Edit menu with a Copy item in it attached to the standard command found in ApplicationCommands : <Menu> <MenuItem Header="Edit"> <MenuItem Header="Copy" Command="ApplicationCommands.Copy" /> </MenuItem> </Menu> I want this item to be handled by a TextBox when it has the focus and by my own controls when they have the focus. In my controls I can handle Execute and CanExecute in code behind by creating a CommandBinding : <UserControl.CommandBindings> <CommandBinding Command=

binding to my current presenter in caliburn without binding convention

佐手、 提交于 2019-12-05 02:00:10
问题 in caliburn when i work with binding convention, and name a content control "CurrentPresenter" the framework automagically bind to the vm and locate the relevant view. if i do this binding manually the view is not located.. how might i achieve this ability without the binding convention (my view is a user control) 回答1: You should bind to View.Model attached property, which: figures out the correct view to represent the VM binds the view DataContext to the VM pushes the view in the

binding to my current presenter in caliburn without binding convention

谁说我不能喝 提交于 2019-12-03 16:35:54
in caliburn when i work with binding convention, and name a content control "CurrentPresenter" the framework automagically bind to the vm and locate the relevant view. if i do this binding manually the view is not located.. how might i achieve this ability without the binding convention (my view is a user control) You should bind to View.Model attached property, which: figures out the correct view to represent the VM binds the view DataContext to the VM pushes the view in the ContentControl's Content property Example: <!-- Caliburn v1.x --> <ContentControl cal:View.Model="{Binding

WPF Context Menus in Caliburn Micro

纵饮孤独 提交于 2019-11-30 06:51:22
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"> <MenuItem Header="Open" cal:Message.Attach="Open($dataContext)"> </MenuItem> </Grid.ContextMenu>

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

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">

Alternatives to Prism + MEF for modular MVVM apps [closed]

安稳与你 提交于 2019-11-28 17:36:27
My team and I are beginning to plan the development of a modular application which will likely multi-target WPF & Silverlight. I personally have some experience using the older version of PRISM to build a composite Silverlight app using the MVVM pattern. We weren't familiar with MEF at the time for handling the various module dependencies, so we didn't use it. We aren't married to any particular framework, but want to use one of the bigger players out there. As such we've begun to examine Caliburn/Caliburn Micro, Prism, MVVM Light and Reactive UI. Most of what I've read for modularity suggests

Windsor LifeStyle - Shared instance per Graph

北城余情 提交于 2019-11-28 02:15:31
I have 2 types of ViewModel's public class ViewModelA { IService service; private ViewModelB childViewModel; public ViewModelA(IService service,ViewModelB childViewModel) { this.service = service; this.childViewModel = childViewModel; } public ViewModelB ChildViewModel { get { return childViewModel; } } } public class ViewModelB { IService serivce; public ViewModelB(IService service) { this.service = service; } } I have a Service registered into a Windsor Container : public class Service : IService {} container.Register(Component.For<IService>() .ImplementedBy<Service >().LifeStyle.Transient);