In my View, I have a button.
When the user clicks this button, I want to have the ViewModel save the context of the TextBlock in the database.
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
<TextBlock Text="{Binding FirstName}"/>
<TextBox Text="Save this text to the database."/>
<Button Content="Save" Comma...
I have been using the DelegateCommand found in the MVVM Visual Studio template at CodePlex. This works very nicely for having Views be able to execute commands on their ViewModel.
I read somewhere that in MVVM "attached behaviors" should be used. As far as I can tell, "attached behaviors" are the same type of pattern as DelegateCommand ...
This code shows that the Delegate Command from the Visual Studio MVVM template works differently when used with MenuItem and Button:
with Button, the command method has access to changed OnPropertyChanged values on the ViewModel
when using MenuItem, however, the command method does not have access to changed OnPropertyChanged values
...
Hey atAll!
Often found answers here, but now it`s my first time ;)
We use the MVVM pattern in conjunction with DelegateCommands. So normally I bind a command to the button like this:
<Button Command="{Binding SetXYZActivatedCommand}" />
I need to execute different commands when the button is pressed and when the button is released a...
In my XAML I have this command (which is an AttachedCommand which I got from http://marlongrech.wordpress.com):
<TextBlock Text="Edit Test Customer">
<Commands:CommandBehaviorCollection.Behaviors>
<Commands:BehaviorBinding Event="MouseLeftButtonDown"
Command="{Binding ClickEditTestCustomer...
I'm trying to bind a button command to take the text of a textbox as a parameter when the button is clicked. My Xaml looks like this:
<TextBox x:Name="InputBox" Width="250" TabIndex="1"
Text="{Binding Path=MessageText, Mode=TwoWay}"
FontFamily="Verdana" FontSize="11" Margin="0,0,4,0" />
<Button x:Name="SendButton" Width="50" ...
I would like to use an MVVM in a WPF project I'm working on, including the use of RelayCommands (aka DelegateCommands). I'm running into an interesting but frustration problem in implementing equality for my ViewModels, outlined here. I have a base class in my ViewModel hierarchy which examines all properties reflectively as part of its ...
I have a template for treeView item:
<HierarchicalDataTemplate x:Key="RatesTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=ID}"/>
<Button CommandParameter="{Binding Path=ID}"
Command="{Binding ElementName=CalcEditView, ...
Hi,
Is there a way to determine if a ToggleButton is Checked/Unchecked via DelegateCommands?
TIA,
mike
XAML code below. I'm using ItemsControl and binding to a collection. I'm basically wanting a way to get the toggle status of each button when it's clicked.
<ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsControl It...
Hi, is there anyway for DelegateCommand's to support gestures when building a composite WPF app? I'm trying to create a command used by a MenuItem and also a Button, which can be accessed through a keyboard shortcut, but which sits inside a class in a separate assembly.
I can use a RoutedCommand, but I want to minimise any code-behind....
I have a simple test app in Silverlight 3 and Prism where I'm just trying to bind a button Click to a simple command I have created on a view model.
This is a test app just to get commanding working.
When I run it I get a binding error telling me that the view cannot find the command:
System.Windows.Data Error: BindingExpression path er...
I am working on a Composite MVVM application and trying to get Global Binding events happening - Except it is NOT!..
the buttons are disabled by default although the CanRun returns true!! !! I have followed the Composite Guide and the OnLoadMenu is not firing!!!
I have been going around in circles (Event Aggregators, DelegateCommands,...
I am trying to unit test my ViewModel and my SaveItem(save, CanSave) delegate command. I want to ensure that CanSave is called and returns the correct value given certain conditions. Basically, how can I invoke the delegate command from my unit test, actually it's more of an integration test. Obviously I could just test the return val...
I just finished desktop apps written in WPF and c# using MVVM pattern. In this app I used Delegate Command implementation to wrap the ICommands properties exposed in my ModelView. The problem is these DelegateCommands prevent my ModelView and View from being garbage collected after closing the view. So it stays larking until I terminate ...
If you're doing MVVM and using commands, you'll often see ICommand properties on the ViewModel that are backed by private RelayCommand or DelegateCommand fields, like this example from the original MVVM article on MSDN:
RelayCommand _saveCommand;
public ICommand SaveCommand
{
get
{
if (_saveCommand == null)
{
...
I am trying to work out an example from ".NET Domain Driven Design with C#", which contains a code example where you can see declared some attributes of type DelegateCommand.
Now, I've tried googling it up, but I can't find its reference anywhere on MSDN (actually, I found this article, but not DelegateCommand's article itself).
Is the...
Is it possible to fire a command to notify the window is loaded.
Also, I'm not using any MVVM frameworks (Frameworks in the sense, Caliburn, Onxy, MVVM Toolkit etc.,)
...