mvvm-foundation

C#: Extending from more than 1 class

我与影子孤独终老i 提交于 2020-01-03 13:03:24
问题 Suppose I have a ViewModel TabViewModel that Extends ObservableObject the class for ViewModels in the MVVM Foundation Framework. Then I also have a EditorTabViewModel that extends TabViewModel , Now I need to extend DependencyObject to implement DependencyProperties. I cannot extend more than 1 class. How might I implement this? I could have an "intermediate" class like ... TabViewModel : ObservableObject EditorTabViewModel : TabViewModel DependentEditorTabViewModel : DependencyObject but

Creating a clickable image in WPF

喜欢而已 提交于 2019-12-18 10:53:16
问题 I want to make a user control that shows an image and can invoke a command when clicked. Later I want to bind a list of these controls to a list of products. 回答1: Try this very straight forward approach <Grid> <Button Height="50" Width="50"> <Button.Template> <ControlTemplate> <Image Source="yourimage.png"/> </ControlTemplate> </Button.Template> </Button> </Grid> private void Button_Click(object sender, RoutedEventArgs e) { // do smt } 回答2: Well, after a little more fiddling, a simple button

Using MVVM Foundation Messenger to Show Dialog

不问归期 提交于 2019-12-12 09:41:23
问题 I'm building a WPF app and trying to conform to MVVM best practices. I'm using the MVVM Foundation framework and noticed the Messenger class, which I've read should be used for handling dialogs in WPF. This sounds great, but I'm totally not understanding how to use a Messenger for this purpose. Literally, all I want to do is open a modal About dialog --I don't need to pass any messages back and forth. Was the intent of the Messenger class to be used for cases where dialogs require a message

Spring AOP + MVVM Foundation + PropertyChanged

隐身守侯 提交于 2019-12-11 07:30:12
问题 I'm using Spring.Net 1.3.1 alongside MVVM Foundation to apply cross-cutting to my viewmodels. I've noticed that if I assign a property changed handler before the object is converted to a proxy for cross-cutting that the proxy engine does not apply the property changed handler to the proxy. Does anyone know if this is expected behavior and if so, if there is a workaround? My factory looks like this public static class AopProxyFactory { public static object GetProxy(object target) { var factory

Query on MVVM pattern in WPF?

北战南征 提交于 2019-12-10 12:09:31
问题 I am implementing a MVVM pattern in my WPF application. My application main window is divided into four parts: Main Menu On the Top Outlook Navigation Control on the Left. A List View on the Middle. Another List view on the bottom. The Navigation control shows different setting (configuration) controls in the Tab items. All the four above are user controls which are placed in the main window. And corresponding to each user control there is separate view model which is bounded with a view

MVVM Foundation: How to close Application Window from ViewModel

你离开我真会死。 提交于 2019-12-07 21:09:36
问题 I am using MVVM Foundation but I think its quite straight-forward and not really framework specific. My setup is as follows: StartViewModel - has a ExitCommand that returns a RelayCommand/ICommand public ICommand ExitCommand { get { return _exitCommand ?? (_exitCommand = new RelayCommand(() => MessageBox.Show("Hello World"))); } } public RelayCommand _exitCommand; StartView (User Control) has a button binded to the ExitCommand <Button Content="Exit" Command="{Binding ExitCommand}" /> 回答1:

MVVM Foundation: How to close Application Window from ViewModel

China☆狼群 提交于 2019-12-06 13:54:48
I am using MVVM Foundation but I think its quite straight-forward and not really framework specific. My setup is as follows: StartViewModel - has a ExitCommand that returns a RelayCommand/ICommand public ICommand ExitCommand { get { return _exitCommand ?? (_exitCommand = new RelayCommand(() => MessageBox.Show("Hello World"))); } } public RelayCommand _exitCommand; StartView (User Control) has a button binded to the ExitCommand <Button Content="Exit" Command="{Binding ExitCommand}" /> First, read as much as you can stomach on MVVM, e.g. WPF Apps With The Model-View-ViewModel Design Pattern on

Draw rectangle when mouse dragged using MVVM in WPF

倾然丶 夕夏残阳落幕 提交于 2019-11-29 07:15:08
Below is my xaml. I have an image inside a canvas. I want to draw rectangle on the image when mouse is dragged on the image. I did it successfully in WPF. But now I want to do it in MVVM. Instead of having the event handlers in code behind I want to have them in my ViewModel. I am using MVVM Foundation for implementing MVVM. Below is a link to MVVM Foundation. http://mvvmfoundation.codeplex.com/ Any help is highly appreciated. XAML <Canvas Name="cnvImage"> <Image Height="348" HorizontalAlignment="Left" Margin="12,39,0,0" Name="imgPreview" Stretch="Fill" VerticalAlignment="Top" Width="443"

Draw rectangle when mouse dragged using MVVM in WPF

与世无争的帅哥 提交于 2019-11-28 01:01:23
问题 Below is my xaml. I have an image inside a canvas. I want to draw rectangle on the image when mouse is dragged on the image. I did it successfully in WPF. But now I want to do it in MVVM. Instead of having the event handlers in code behind I want to have them in my ViewModel. I am using MVVM Foundation for implementing MVVM. Below is a link to MVVM Foundation. http://mvvmfoundation.codeplex.com/ Any help is highly appreciated. XAML <Canvas Name="cnvImage"> <Image Height="348"