mvvm-light

How can I ensure closed dialogs are unregistered from INPC events?

ε祈祈猫儿з 提交于 2019-12-24 11:56:55
问题 I have an MVVM-Light based WPF application, with a dialog service (called WindowManager ) that opens up dialog windows bound to pre-initiated dialog view-models, like this: private enum ViewModelKind { PlanningGridVM, InputDialogVM, TreeViewDialogVM, SaveFileDialogVM, MessageBoxVM } /// <summary> /// Shows the Window linked to this ViewModel as a dialog window. /// </summary> /// <typeparam name="TViewModel">The type of the view model.</typeparam> /// <returns>Tri-state boolean dialog

Combine dependency properties

 ̄綄美尐妖づ 提交于 2019-12-24 11:14:33
问题 I've done a few WPF projects now and see the same problem pop up and that is the "problem" of aggregating/combining dependency properties (dp's). For example, I have 10 dp's of type bool that I want to combine and expose as a seperated dp. The combined dp is true unless one or more its constituents is false. I currently do this using the addValueChanged which registers a callback for each of the 10 (!() dp's but am wondering if there are more elegant solutions or maybe a framework that

Combine dependency properties

拟墨画扇 提交于 2019-12-24 11:13:50
问题 I've done a few WPF projects now and see the same problem pop up and that is the "problem" of aggregating/combining dependency properties (dp's). For example, I have 10 dp's of type bool that I want to combine and expose as a seperated dp. The combined dp is true unless one or more its constituents is false. I currently do this using the addValueChanged which registers a callback for each of the 10 (!() dp's but am wondering if there are more elegant solutions or maybe a framework that

EventToCommand in button style

纵然是瞬间 提交于 2019-12-24 09:18:10
问题 I want to assign the same command to all my buttons on my user control. I use MVVM Light and I have tried all combinations. I have also tried to use EventSetter, but this does not allow binding to a command in the ViewModel Here is a sample of what I am trying to do: <Style x:Key="CalculatorButton" TargetType="telerik:RadButton"> <Setter Property="Margin" Value="2"/> <Setter Property="Cursor" Value="Hand"/> <Style.Triggers> <i:EventTrigger EventName="Click"> <cmd:EventToCommand Command="

Understanding the life cycle of BindingContext in Xamarin?

删除回忆录丶 提交于 2019-12-24 08:43:30
问题 I have a basic registration page when the user register her data, I save an object of this data in a static field of the Settings static class , so I can fill the common fields with other registration pages, like first_name , last_name , email ...etc. so the user doesn't have to re-fill them again. the very specific case I have is, one of these common pages is the basic registration page itself (with some fields excluded). first that's how the common fields look like: <Entry Text="{Binding

Mvvm-Light User Control RelayCommand TemplateBinding

孤者浪人 提交于 2019-12-24 08:28:36
问题 [UWP - Windows 10] I'm new to MVVM-Light and so I got some starter issues. I created a custom Usercontrol which is called TileToolbar and is containing this xaml: <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <RadioButton Style="{StaticResource NavRadioButtonStyle}" Tag="" Foreground="Green"></RadioButton> <RadioButton Style="{StaticResource NavRadioButtonStyle}" Tag="" Foreground="Green"></RadioButton> <RadioButton Style="{StaticResource NavRadioButtonStyle}" Tag=""

MVVM Light: Register generic class for messenger

可紊 提交于 2019-12-24 06:43:39
问题 I have a generic ShowMessage class that I want to use to carry data around: class ShowMessage<T> { private readonly T _Data; public string Title { get; set; } public T Data { get { return _Data; } } public ShowMessage( T data) { _Data = data; } } In my ViewModel I want to register for all possible ShowMessage instances, but currently I haven't found a way. Has anyone registered a generic base class (note: I want to register only once and not n-times to have a clean code) Edit: To make my

Mvvm Light message recipient action being garbage collected

ぃ、小莉子 提交于 2019-12-24 05:13:09
问题 My wpf application has child windows that popup to show views to the user. The child windows are closed by executing CloseCommand on the window's viewmodel, which sends a CloseWindowMessage using itself as the token. This is the viewmodel used: public class ChildWindowViewModel : ViewModel { ICommand _closeCommand; public ICommand CloseCommand { get { if (_closeCommand == null) _closeCommand = new RelayCommand(DoClose); return _closeCommand; } } public void DoClose() { System.GC.Collect();

iOS App Store ExecutionEngineException attempting to JIT compile

元气小坏坏 提交于 2019-12-24 04:14:50
问题 I have a really awkward problem. I have build my app for iOS and tested it on all emulators and it works fine. I have installed it on a device (iPhone 6 plus) and that works fine as well. However, when I submit it to the app store, the feedback is that it crashes on launch on all devices. The crash log attached shows this error; Unhandled Exception: System.ExecutionEngineException: Attempting to JIT compile method 'GalaSoft.MvvmLight.Messaging.Messenger:get_Default ()' while running with -

RelayCommand<PasswordBox> CanExecute never runs on Windows 8.1 store but it does on WPF

蹲街弑〆低调 提交于 2019-12-24 00:45:23
问题 I'm developing a Windows 8.1 store app with C# and .NET Frameowork 4.5.1. I'm trying to pass a PasswordBox as a parameter on a button Command . I've tested the following code on WPF and it works. MainViewModel class: public class MainViewModel : ViewModelBase { private RelayCommand<PasswordBox> doLoginCommand; /// <summary> /// The <see cref="UserName" /> property's name. /// </summary> public const string UserNamePropertyName = "UserName"; private string _userName = string.Empty; ///