prism

Injecting a property into a singleton service in Prism (Unity, MVVM)

删除回忆录丶 提交于 2020-01-17 04:26:45
问题 For reference, I have a service that I want to register as a singleton in the unity container. I want this service to have the IEventAggerator injected into the service somehow, either by property or constructor injection. public class BeckhoffService: IProgrammableLogicController { ...} and I'll either want this: [Dependency] public IEventAggregator eventAggregator{get;set;} or in the constructor: BeckhoffService(IEventAggregator eventAggregator) My issue comes when I register this service

How to inject views into TabControl using Prism?

允我心安 提交于 2020-01-16 04:07:05
问题 I followed from the quick start example about UICompositon. In my case I had a project A to hold the TabControl, a project B to hold the DataGrid which act as Content to be injected into the TabControl. The TabControl has no viewModels, It uses <Style TargetType="{x:Type TabItem}" x:Key="HeaderStyleS"> <Setter Property="Header" Value="{Binding RelativeSource={RelativeSource Self}, Path=Content.DataContext.ViewName}" /> </Style> <TabControl regions:RegionManager.RegionName="TabRegion"

When should my prism services be registered?

不羁的心 提交于 2020-01-15 16:40:52
问题 I've been struggling with the ideal approach to this. Right now, I have my services created in Boostrapper right before I create my application shell, in the method: protected override DependencyObject CreateShell() After my shell gets created, I then create all my view models, passing the services they need. So firstly, I want to know if that's a good practice. Also, I've tried to find examples of declaring services inside a .config file, but I really didn't see any. Is this not a good

Working with DelegateCommand's CanExecute action

心不动则不痛 提交于 2020-01-15 07:55:12
问题 I've a ViewModel class like this in a Prism / WPF project. public class ContentViewModel : ViewModelBase, IContentViewModel { public ContentViewModel(IPersonService personService) { Person = personService.GetPerson(); SaveCommand = new DelegateCommand(Save, CanSave); } public Person Person { get; set; } public DelegateCommand SaveCommand { get; set; } private void Save() { // Save actions here... } private bool CanSave() { return Person.Error == null; } } The person type used in the above

Xaml TabControl in the top of window

烈酒焚心 提交于 2020-01-14 04:53:22
问题 Hi All! I have a trouble with xaml-markup design that is shown on a picture. How to place window buttons in one line with tab item headers TAB1 , TAB2 , TAB3 ? I use custom control for window buttons like: <Border> <StackPanel Orientation="Horizontal"> ... buttons ... </StackPanel> </Border> Does anyone have ideas how I can implement this? 回答1: You will probably have to remove the window border and draw the buttons yourself. You'll have to handle button clicks yourself (don't forget that

Xaml TabControl in the top of window

落花浮王杯 提交于 2020-01-14 04:53:07
问题 Hi All! I have a trouble with xaml-markup design that is shown on a picture. How to place window buttons in one line with tab item headers TAB1 , TAB2 , TAB3 ? I use custom control for window buttons like: <Border> <StackPanel Orientation="Horizontal"> ... buttons ... </StackPanel> </Border> Does anyone have ideas how I can implement this? 回答1: You will probably have to remove the window border and draw the buttons yourself. You'll have to handle button clicks yourself (don't forget that

Prism: have to call RaiseCanExecuteChanged() explicitly

一个人想着一个人 提交于 2020-01-14 03:05:30
问题 Below is a very simple Prism.Wpf example with a DelegateCommand that has both Execute and CanExecute delegates. Suppose that CanExecute depends on some property. It seems that Prism's DelegateCommand doesn't re-evaluate CanExecute condition automatically when this property changes, as RelayCommand does in other MVVM frameworks. Instead, you have to call RaiseCanExecuteChanged() explicitly in the property setter. This leads to a lot of repetitive code in any non-trivial viewmodel. Is there a

What should I use in Prism- MEF or Unity?

不羁的心 提交于 2020-01-12 04:48:06
问题 Found several good(related) questions here and here but all are nearly a year old. I will like to know in the current context of Prism development what is better or at least scenario where each is better. 回答1: They are two approaches to solving some-what overlapping scenarios. Unity shines when you are developing a modular application where users will be using a subset of the modules and modules are self-contained. MEF shines when you have a lot of 3rd party developers creating plug-ins for

Prism PopupChildWindowAction in Desktop DLL missing

我只是一个虾纸丫 提交于 2020-01-11 06:18:00
问题 I am trying to implement modal dialog in the WPF Prism Desktop application. From Prism guidance I can see that proper way should be using Interaction: <i:Interaction.Triggers> <prism:InteractionRequestTrigger SourceObject="{Binding ConfirmCancelInteractionRequest}"> <prism:PopupChildWindowAction ContentTemplate="{StaticResource ConfirmWindowTemplate}"/> </prism:InteractionRequestTrigger> </i:Interaction.Triggers> But PopupChildWindowAction is not available in the Microsoft.Practices.Prism

Prism PopupChildWindowAction in Desktop DLL missing

孤人 提交于 2020-01-11 06:15:24
问题 I am trying to implement modal dialog in the WPF Prism Desktop application. From Prism guidance I can see that proper way should be using Interaction: <i:Interaction.Triggers> <prism:InteractionRequestTrigger SourceObject="{Binding ConfirmCancelInteractionRequest}"> <prism:PopupChildWindowAction ContentTemplate="{StaticResource ConfirmWindowTemplate}"/> </prism:InteractionRequestTrigger> </i:Interaction.Triggers> But PopupChildWindowAction is not available in the Microsoft.Practices.Prism