mvvm-light

XAML Heartbeat Animation - How to ensure heart beats at least twice

删除回忆录丶 提交于 2019-12-09 23:58:13
问题 Greetings, I would like to visually show when a background process is working. This process happens at a regular intervals (say every 30 seconds), and might take 10ms or 1000ms+ to complete. I'm using MVVM-Light framework so have created a data trigger wired up to a view model property on an image of a heart fading in and out. My amateur animation technique is working when the process takes a second or more, but I would also like it to complete a full heartbeat (2 repeats) when the process

Bindings Not Updating without Specific DataContext

回眸只為那壹抹淺笑 提交于 2019-12-09 23:57:44
问题 I have a MVVM Light View Model with a ListBox bound to a List<>. The Listbox gets populated initially just fine, but when I change to a different list at runtime (not just adding items), it does not get updated unless I set the specific Data context. So this works: ... DataContext="{Binding MyViewModel, Source={StaticResource Locator}}" <ListBox ItemsSource="{Binding MyList}"/> But this doesn't: DataContext="{Binding Source={StaticResource Locator}}" <ListBox ItemsSource="{Binding MyViewModel

How to register a class instance including a parameter in SimpleIOC

杀马特。学长 韩版系。学妹 提交于 2019-12-09 23:49:19
问题 I need to create an instance of a ViewModel with a specific parameter passed to the ViewModel when created. At the same time this ViewModel instance should be registered in SimpleIOC i thought this was the method for it: SimpleIoc.Register<TClass> Method (Func<TClass>, String, Boolean) with set to true for the last parameter for instant creation. so if i understood that correctly, this method wants a reference to a method that will create my ViewModel instance. This is called a ClassFactory

Communication between ViewModels

 ̄綄美尐妖づ 提交于 2019-12-09 23:34:12
问题 I have two questions regarding communication between ViewModels. I am developing a customer management program. I'm using Laurent Bugnion's MVVM Light framework. In the main page, there's a list of customers. when each customer is clicked, a child windows shows up with information about that customer. the user should be able to open up multiple child windows at the same time and compare information between customers. how do you pass customer object from the main page's ViewModel to the child

How do I notify a parent view of a child view event in an MVVM WPF application?

谁都会走 提交于 2019-12-09 21:40:03
问题 I have an MVVM based WPF desktop application. I'm utilizing MVVMLight and Prism to create user controls which contain views and sub-views. I have button on a child view. (Let's say it's a close button) What is the best way to propagate notification of the click event from the nested child view up to it's containing parent view? 回答1: The child view could use the EventAggregator in Prism or the Messenger class in MvvmLight to send a message that the parent view (or view model) subscribes to.

Wpf User Security Strategy

空扰寡人 提交于 2019-12-09 13:52:53
问题 BACKGROUND: I am creating a WPF application (.NET 4.5 with MVVM-Light) I have created user roles in the database that backs the WPF application where the users of the WPF App have an assigned role (i.e. user, manager, owner, admin ) WHAT I WANT: My client wants to be able to restrict what the users see and what the users can do based on their role. There are some views that will be seen by all users, therfore some visual elements (grids, buttons etc..) should be hidden or disabled depending

How should I communicate between ViewModels?

折月煮酒 提交于 2019-12-09 10:50:06
问题 I am using MVVM Light and have used the packaged messenger system to communicate between view models, however I have hit a bit of a dilemma! Basically when a user clicks on a customer record the corresponding view is opened and with it the CustomerViewModel is instantiated. At this point the CustomerViewModel requires the selected customers ID from the previous view model ( ViewAllCustomersViewModel ) so that it can get selected customers info which the view binds to (still following?). So

UserControl InputBindings Only working after pressing a button first

无人久伴 提交于 2019-12-08 18:18:29
问题 Buttons working fine as expected by clicking them. Issue: When the UserControl is loaded for the first time and i didn't press any button in it, the Keybinds are not working. After clicking a button manually the keybinds do work as intended. So obviously i would like to let the user use the keybind before any button press :) (I already tried to set focus on different elements such as the button itself) Sample code, of how i setup my commands: (using MVVM-light toolkit) ContextBinding

Why MVVM Light copies system assemblies to application folder?

我怕爱的太早我们不能终老 提交于 2019-12-08 15:56:10
问题 Adding MVVM Light reference to a WPF projects adds a large number of system assemblies to the list of dependencies in the accompanying MSI Setup project. These assemblies (50+ in number) are then copied to the application folder when the app is installed. Why is it so? Why can't it reference it from GAC directly? Note: Copy Local option is set to True for MVVMLight.dll. I obviously can't set it to False. Reproducing it is extremely simple. I'm using VS2015 Community. Create a new WPF

MVVM WPF change window and close the previous

夙愿已清 提交于 2019-12-08 11:35:26
问题 As a starter in this all architecture of MVVM I'm having a few doubts regarding the navigation between one window to another. I'm using the Framework MVVM Light. The behavior I expect is in WinForms like this: GeneralWindow gw = new GeneralWindow(); this.Hide(); // or close gw.Show(); I already lose a couple of hours trying to find some hints using the messenger, but the methods I found I have to use code-behind in the view and that is not very MVVMish. Best regards and thank you in advance.