Questions tagged [commandparameter]

127 questions
29
votes
3 answers

passing the current Window as a CommandParameter

how can I pass the window I am currently on as a parameter to a command? I like to do this in XAML-markup:
SwissCoder
  • 2,514
  • 4
  • 28
  • 40
23
votes
4 answers

How do I pass the Button as CommandParameter from XAML in a Xamarin.Forms Page?

I would like to pass a Xamarin.Forms.Button in it's own Command as the CommandParameter to my ViewModel. I know how to achieve this from the code behind e.g. ... XAML (with most properties missed out for brevity)
15
votes
3 answers

Binding a WPF Button CommandParameter to the Button itself in DataTemplate

I have a DataTemplate that represents AppBar buttons that I declare through a collection of custom AppBarCommand objects. public AppBarCommand(RelayCommand command, string buttonstyle) { Command = command; ButtonStyle = buttonstyle; …
Jippers
  • 2,635
  • 5
  • 37
  • 58
10
votes
5 answers

How do I pass a variable as a CommandParameter

I'm trying to send a variable from the ViewModel as a parameter to a command. The command looks like this: public class EditPersonCommand : ICommand { private bool _CanExecute = false; public bool CanExecute(object parameter) { …
SwDevMan81
  • 48,814
  • 22
  • 151
  • 184
9
votes
1 answer

WPF CommandParameter binding not updating

I am trying to use Command and CommandParameter binding with Buttons in a WPF application. I have this exact same code working just fine in Silverlight so I am wondering what I have done wrong! I have a combo box and a button, where the command…
ColinE
  • 68,894
  • 15
  • 164
  • 232
9
votes
1 answer

MVVM-Light => Pass Command Parameter AND EventArgs to Command

Using MVVM-Light Toolkit in Silverlight 5, i am trying to find a way to pass Command Parameters AND EventArgs both to ViewModel in an Event-To-Command behavior. I did find a post suggesting Passing EventArgs as Command Parameters but in my case i…
Thr3e
  • 358
  • 1
  • 6
  • 22
8
votes
1 answer

How to correctly bind menu items?

How do i correctly bind a dynamical created list of menu items. I have tried several thing but none seem to work. I get the proper list of names, however my ViewSwitchCommand does not seem to fire correctly.
poco
  • 2,935
  • 6
  • 37
  • 54
5
votes
3 answers

Silverlight: How do I pass True to a CommandParameter?

How do I pass True to a CommandParameter? Currently I am imperatively adding Boolean.True to the resource dictionary, but that seems like a clumsy way to do it.
Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447
5
votes
3 answers

Passing a Command Parameter from a Datagrid through a Keybinding

I've a wpf specific problem. I'm trying to delete a Row from a Datagrid, by defining a Keybinding that passes the selected Row of the Datagrid as a Commandparameter to a Command. This is my Keybinding:
OnTheFly
  • 2,059
  • 5
  • 26
  • 61
4
votes
2 answers

How to pass a parameter in a button and get value in the code behind to redirect to another page based on the value of parameter in windows phone 7?

I am thinking if the windows phone 7 button event is similar to ASP.NET development with C#, something like in the button, I set value to commandparameter in the XAML, and in the code behind, I get the commandparameter and redirect the page. I…
Xiao Han
  • 1,004
  • 7
  • 16
  • 33
4
votes
2 answers

XAML Binding with Delay and KeyBinding

I have this XAML code that works like a charm:
Carlos
  • 1,638
  • 5
  • 21
  • 39
4
votes
2 answers

Pass CommandParameter to Command in Silverlight using MVVM

I'm just learning Silverlight and looking at MVVM and Commanding. Ok, so I have seen the basic RelayCommand implementation: public class RelayCommand : ICommand { private readonly Action _handler; private bool _isEnabled; public…
Mike
  • 6,149
  • 5
  • 34
  • 45
4
votes
1 answer

Pass typeof as parameter to a command from xaml

I'm building an application which has a RibbonWindow and a TabCollection. Every RibbonButton has a command to open a tab of a specific UserControl. Every command does the same with a very small difference, they open a tab with a specific…
Verendus
  • 1,026
  • 1
  • 13
  • 26
4
votes
1 answer

How to send a property of the current element as as a command parameter in WPF?

I have a button with a Background color, and I want to send this Background color as the Command Parameter to the Command Binding! How can I do that?
3
votes
3 answers

Command Parameter equivalence in Windows Phone?

So in WPF there is a CommandParameter attribute that you can use in your XAML code to send information about what is selected to your CS code to use. I am trying to learn Windows Phone 7 programming and it seems very similar to WPF, so I thought I…
pongahead
  • 1,984
  • 3
  • 18
  • 21
1
2 3
8 9