eventtocommand

Validation.error event in event command

别说谁变了你拦得住时间么 提交于 2019-12-24 13:25:15
问题 I have a text box: <TextBox Height="20" Width="150" Text="{Binding MyProperty,NotifyOnValidationError=True,ValidatesOnDataErrors=True}" > <i:Interaction.Triggers> <i:EventTrigger EventName="Validation.Error"> <mvvm:EventToCommand Command="{Binding MyCmd}" PassEventArgsToCommand="True" ></mvvm:EventToCommand> </i:EventTrigger> </i:Interaction.Triggers> </TextBox> My ViewModel looks like this: public class MyViewModel : ValidationViewModelBase, INotifyPropertyChanged { private int myVar; [Range

WPF How to add blend interaction trigger to style resource

ぃ、小莉子 提交于 2019-12-23 03:15:47
问题 I am using VS 2012, with WPF 4.5 I want to be able to add a blend interaction trigger to a style resource so that I can have that defined in one place (resource dictionary) and use in many places throughout my app. Specifically, I want to use the EventToCommand that comes with the MVVM-Light framework and have it inserted into a textbox style and attached to the LostFocus event of the textbox. I am planning on using this to mark certain textboxes with a ValidationStyle that triggers a bound

EventToCommand for Loaded event not working as expected if Window.SizeToContent = WidthAndHeight

帅比萌擦擦* 提交于 2019-12-22 05:06:00
问题 I find out that the EventToCommand for the Loaded-event is not working as expected if the Window.SizeToContent attribute is set to WidthAndHeight . The Loaded-event seems to be fired correctly, but the EventToCommand.Command property is bound AFTER the Loaded event is fired. If SizeToContent is Manual the Command will be bound BEFORE Loaded is fired and it works as expected. Does anyone also have problems with this behavior and/or an explanation for this? My workaround for now is to bind to

How to use an EventToCommand with an editable Combobox to bind TextBoxBase.TextChanged with a command?

落花浮王杯 提交于 2019-12-11 01:11:14
问题 I have an editable ComboBox. <ComboBox IsEditable="True"> <i:Interaction.Triggers> <i:EventTrigger EventName="SelectionChanged"> <cmd:EventToCommand Command="{Binding CritereChangedCommand, Mode=OneWay}"/> </i:EventTrigger> <i:EventTrigger EventName="TextBoxBase.TextChanged"> <cmd:EventToCommand Command="{Binding CritereChangedCommand, Mode=OneWay}"/> </i:EventTrigger> </i:Interaction.Triggers> </ComboBox> I use GalaSoft.MvvmLight.Command.EventToCommand to bind the SelectionChanged event. I

EventToCommand with attached event

主宰稳场 提交于 2019-12-10 08:44:02
问题 I use on attached event Validation.Error of the TextBox. Validation.Error I want to bind it to EventToCommand . Normally it does not work: <TextBox Height="20" Width="150" Text="{Binding MyProperty,NotifyOnValidationError=True,ValidatesOnDataErrors=True}" ><!--Validation.Error="TextBox_Error"--> <i:Interaction.Triggers> <i:EventTrigger EventName="Validation.Error"> <mvvm:EventToCommand Command="{Binding MyCmd}" PassEventArgsToCommand="True" ></mvvm:EventToCommand> </i:EventTrigger> </i

Binding CommandParameter on ItemsControl Tap event

瘦欲@ 提交于 2019-12-07 11:26:13
问题 I'm using an ItemsControl, and I want to identify which item was selected on the Tap command. My xaml is defined here: <ItemsControl ItemsSource="{Binding AllMyItems}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Tap"> <cmd:EventToCommand Command="{Binding ItemSelectedCommand}" CommandParameter="{Binding}"/> </i:EventTrigger> </i:Interaction.Triggers> .... item template .... and here is my view model: public RelayCommand<MyItem> ItemSelectedCommand { get; private set; } public

EventToCommand for Loaded event not working as expected if Window.SizeToContent = WidthAndHeight

人走茶凉 提交于 2019-12-05 04:39:05
I find out that the EventToCommand for the Loaded-event is not working as expected if the Window.SizeToContent attribute is set to WidthAndHeight . The Loaded-event seems to be fired correctly, but the EventToCommand.Command property is bound AFTER the Loaded event is fired. If SizeToContent is Manual the Command will be bound BEFORE Loaded is fired and it works as expected. Does anyone also have problems with this behavior and/or an explanation for this? My workaround for now is to bind to the DataContext of the window: <i:Interaction.Triggers> <i:EventTrigger EventName="Loaded" > <command

EventToCommand missing on MVVM Light

限于喜欢 提交于 2019-12-02 03:28:56
问题 This helpful class seems to be gone from the latest MVVM Light build, any idea why or how to work around it? I'm using MvvmLightLibs.5.0.1.0, was definitely there on MvvmLightLibs.4.1.27.0. So this question is not related with one EventToCommand Missing For Windows Phone App Environment: VS2013, WP8.0 回答1: Eventually, I found the EventToCommand class on Galasoft.MvvmLight.Platform. I guess the assembly change makes sense being a multi-platform framework. xmlns:Command="clr-namespace:GalaSoft

EventToCommand missing on MVVM Light

别等时光非礼了梦想. 提交于 2019-12-02 01:10:42
This helpful class seems to be gone from the latest MVVM Light build, any idea why or how to work around it? I'm using MvvmLightLibs.5.0.1.0, was definitely there on MvvmLightLibs.4.1.27.0. So this question is not related with one EventToCommand Missing For Windows Phone App Environment: VS2013, WP8.0 Eventually, I found the EventToCommand class on Galasoft.MvvmLight.Platform. I guess the assembly change makes sense being a multi-platform framework. xmlns:Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform" <i:Interaction.Triggers> <i:EventTrigger EventName=

MVVM Light: Adding EventToCommand in XAML without Blend, easier way or snippet?

霸气de小男生 提交于 2019-11-26 15:24:42
Can anyone tell me what the actual syntax is for EventToCommand class. From what I believe is that EventToCommand class works with Silverlight / WPF and WP7, hence I think its a better choice to go down. From what I believe, I can add any click event and get it forced into my ViewModel , but I am having an issue in finding the best way to do this. I know you can add it without Blend, but are there snippets available? Or is there an easier way to add it via VS 2010? Any help or if anyone knows of a good tutorial on this would be great. Suppose you use .NetFramework4 : First add namespace :