Questions tagged [icommand]

Interface for MVVM scenarios in Silverlight and WPF to bind commands from models to controls (Buttons).

icommand
Filter by
Sorted by
Tagged with
0 votes
0 answers
33 views

Need help to pass Command property through RelayCommand to User Control by using a binding in WPF [duplicate]

I was asked to build a user control for a button, with icons, custom texblocks, etc. The thing is, I need to obviously be able to pass a command for the Button, but when I try to do it with Dependency ...
Flacuchentxox's user avatar
0 votes
1 answer
26 views

Basic PowerShell XAML Button binding to ICommand

I have the following PowerShell script, which is nothing more than a XAML WPF GUI with a button that is supposed to show a MessageBox when clicked. It loads properly, but does nothing when clicked. ...
Christopher DeCurtins's user avatar
-1 votes
2 answers
89 views

WPF CommandBindings, ViewModel and UserControl

I'm quite new to WPF so it would be better that I will describe the intent: I have multiple User Controls inside the main window. Each User Control has its own buttons, that I would like to bind to ...
Altair Jones's user avatar
0 votes
1 answer
40 views

ContentDialog - What to Use For SecondaryButtonCommand

I am creating a general purpose Exception message dialog, and want to have a "Copy Error" button to copy the error text to the clipboard. I cannot figure out what to use for ...
Jim D's user avatar
  • 119
0 votes
1 answer
33 views

DataGrid Context Menu Not Binding Properly

I have a DataGrid to which I am trying to add a ContextMenu with a command binding. The ContextMenu is defined like so: <DataGrid Grid.Row="6" Grid.Column="0" Grid.ColumnSpan=&...
Dominick's user avatar
  • 444
-1 votes
1 answer
30 views

WPF Custom Control with buttons

I have created a WPF custom control for my application. I am now struggling to wire up the events for some of the controls in the control (ToggleButtons). I have defined the following: WindowHeader....
Richard Gale's user avatar
  • 1,880
0 votes
1 answer
49 views

DatePicker ICommand executed multiple times

I have a DatePicker with an ICommand which perform certain tasks. For some reason when I select a date, the VM.SetPreviousDate() method is called multiple times when the Icommand is executed (at least ...
May Nguyen's user avatar
0 votes
1 answer
135 views

Command for DatePicker in WPF project

I'm working on a WPF project using MVVM and I want to create a command for a DatePicker but I have no luck. I have this setup but it doesn't trigger the command on Date selection. What I want to do is ...
May Nguyen's user avatar
1 vote
1 answer
360 views

Why is the ICommand not triggered in my MAUI app?

At the XAML I got a button using a command: <Button Text="Month" Command="{Binding SetMonthCommand}"/> At the ViewModel class I implement the Command: public ICommand ...
Frank Mehlhop's user avatar
0 votes
0 answers
51 views

Navigation command works when called by button but not when called programmatically

I have a WPF app which has two User Controls. On one user control, I have a list of buttons which are all binded to a command that changes the ViewModel from that user control to the other, with a ...
Ethan Shoe's user avatar
1 vote
1 answer
1k views

.NET MAUI pass picker value to ICommand

I'm a beginner with .NET MAUI and I'm trying to pass a Picker value to an Icommand, but what I can receive is only this date 01/01/1900 The Icommand is fired but the date still 01/01/1900 This is my ...
Orion77's user avatar
  • 102
-1 votes
2 answers
308 views

C# WPF Declare an ICommand in a single line

I'm in the process of learning WPF and the MVVM design pattern. Currently the code in my ViewModel for a delete customer command looks like this: public class vmCustomers : INotifyPropertyChanged ...
Mark Roworth's user avatar
-1 votes
2 answers
107 views

CurrentViewModel Property Change Not Reflected in ContentControl

I am currently building an application where the user can select different pages via a collection of radio buttons. When the page is active I want the radio button to be checked as true. When the ...
Hack.Sign's user avatar
0 votes
1 answer
149 views

Dependency Property command's CanExecute() not updating

I have a user control and within I defined the following property: public string MyProperty { get { return (string)GetValue(MyPropertyProperty); } set { SetValue(MyPropertyProperty, value);...
Anno's user avatar
  • 831
1 vote
0 answers
13 views

MVVM AsyncExecute causing lag

AsyncExecute method causing lag in my treeview application when I am expanding a branch. Important parts of my TreeView public DirectoryItemViewModel(string fullPath, DirectoryItemType type, long size)...
Palamar66's user avatar
  • 222
-1 votes
1 answer
205 views

How to implement CanExecuteChanged on Commands which can always be executed

Let's say you want to create an ICommand that can always be executed. Then it's canExecute method should always return true. And the CanExecuteChanged event is basically not very useful. In my mind it ...
Boris Month's user avatar
-1 votes
1 answer
175 views

wpf The relayCommand needs a constractor that takes parameter

my goal is filter a dataGrid with a textbox input, so i have textbox to filter a datagrid. for all the other commands i used one of these constractors in my **relayCommand ** as follows: // ...
farzadwpf's user avatar
0 votes
1 answer
491 views

Relay Command CanExecute is only invoked in the viewmodels constuctor once but won't invoke again when Properties are changed

What I want to do: When my view is loaded, one can see several textboxes that are compulsory fields(marked red). For as long as those textboxes are not filled out, the button "NEXT" is ...
timunix's user avatar
  • 609
0 votes
0 answers
20 views

Navigate to a new window on item click in ItemTemplate in WPF [duplicate]

I have created a Grid with ItemTemplate and now on click of any item I want user to navigate to new screen. I have added ICommand function in ViewModel for this but I am not able to handle the Command ...
mars_dev's user avatar
  • 607
0 votes
1 answer
200 views

HttpClient.GetAsync not re-enabling the button MVVM

Solved: See below. Update: This fails on the HttpClient.GetAsync. It's like a "Task Finished" event isn't listened to. I'm suspecting a threading problem. It manifests itself as the ...
Ray's user avatar
  • 425
0 votes
2 answers
531 views

WPF - Connect EventSetter to an ICommand

I'm looking for a solution where I double click on a DataGridRow that calls a method in my ViewModel with an ICommand. I have this code for my DataGrid's DataGridRow style: <DataGrid.Resources> ...
Mc_Topaz's user avatar
  • 617
-1 votes
1 answer
220 views

How to bind a ICommand into a Button out of DataContext?

i have a Button into a DataGrid with a DataContext (KeyValuePair). I want to implementing a Command into this Button. But if i use the Command="{Binding CommandoTest}" it didnt work. I ...
MalinaStempel's user avatar
0 votes
1 answer
227 views

WPF ICommands Binding

I am continuing my exploration of WPF and trying to follow MVVM with Commands. My simple code is as follow. MainWindow.xaml <Window x:Class="ClickCommand.MainWindow" xmlns="...
StephenH's user avatar
0 votes
1 answer
122 views

If dependency property is true, then ICommand property should execute

Ok, I have the custom control with its style and the view model with the ICommand property in the different files. CustomControl.cs public class CustomButtons: Control { public static readonly ...
Manav Mehta's user avatar
0 votes
2 answers
126 views

Disable CanExecute on switching views

I have a static property which tracks property changes in my viewmodels: public static class Global { public static int Warning { get { return _warning; } set { _warning = value; ...
Lucy82's user avatar
  • 672
0 votes
1 answer
681 views

WPF - MVVM - View doesn't update when changing properties of a VM instance

I'm fairly new to MVVM and WPF so take everything what I'm saying with a grain of salt. My problem is quite complex and I've been trying to find a solution for the past day now. To no avail... Context ...
Florianvdab's user avatar
0 votes
0 answers
33 views

Add UIElement to the MainWindow with ICommand C#

I would like to add dinamically UIElement through ICommand. It is working fine with EventHandler but when I try to do the same using ICommand the UIElement is invisible however it seams the stackpanel ...
Milán's user avatar
  • 1
0 votes
0 answers
371 views

Carousel View in Xamarin forms not responding to Image button in the view

I cannot get the image buttons to move the carousel image to the next in the list. when I click the imagebutton and step through the code the Position is changing properly, but does not move the ...
marcusC's user avatar
  • 11
0 votes
1 answer
41 views

is it possible to create an invisible xaml command always set to true?

I am working with a window and I would like to create a command that is invisible (or virtual, I am not sure about how it is called) and always checks itself (always true during runtime). This way I ...
Josh.h's user avatar
  • 71
0 votes
1 answer
129 views

WPF ObservableCollection & InotifyPropertyChanged [duplicate]

the model class represents the database. I pull the data from the database in the viewmodel and display it in the datagrid. When I change the corresponding cell in the datagrid, this change is not ...
Fatih Kundak's user avatar
1 vote
1 answer
317 views

React to updates on ObservableCollection

I have the following piece of code: ReactiveCommand .CreateFromTask(_ => GetPerson()) .Execute() .Subscribe(x => person = x); var canNext = person?.Friends ....
Kyle Grierson's user avatar
0 votes
1 answer
1k views

Passing a parameter to RelayCommand

I'm experimenting with the ICommand and RelayCommand constructs. Looking around, I've put together the following code: public class RelayCommand : ICommand { private Action<object> ...
Giovanni Nieddu's user avatar
1 vote
3 answers
3k views

Blazor - How to execute the form submit in Button click using ICommand

How to execute the form submit in Button click using ICommand How to pass parameter in ICommand execute @using System.Windows.Input <button @onclick="buttonClick"> Blazor Button</...
M K's user avatar
  • 1,981
0 votes
1 answer
608 views

wpf-mvvm how can i validate my data with icommand?

I'm new to WPF development and I don't get any further with google either. I don't understand how I can validate my model data with ICommand. I understand that there are annotations and that the ...
TheWorldDrown's user avatar
0 votes
1 answer
61 views

Cannot bind value with command parameter

I need get the Text value from TextBox tag in my SubmitCommand but I only get an empty value. Please help me find out what I need to do for to display the text in my MessageBox. <UserControl> ...
Ros97's user avatar
  • 61
0 votes
1 answer
263 views

Xamarin: Grouped ListView not binding delete Command using MVVM

I'm getting crazy trying to bind a Command in order to remove an item from a grouped ListView. My ViewModels inherit from a BaseViewModel in order to ease the notification of a changing property. I ...
exrezzo's user avatar
  • 507
0 votes
1 answer
359 views

Custom event in custom view model binding

I have searched far and wide. My problem is, that I can’t find a solution to this very simple problem of mine. I have a page, which hosts a data grid. The goal is to have the name in the data grid ...
Weirdmind's user avatar
0 votes
0 answers
70 views

Is there a way to be notified when an ICommand is executed?

Here is my code: var viewModel = factory.Create(); var commandBinding = new CommandBinding(viewModel.Command, (target, e) => { ...
PlaTyPuS's user avatar
  • 385
0 votes
3 answers
956 views

WPF EventHandler for TextBox.TextChanged in XAML or code behind?

Description In WPF, using MvvmLight, I have a viewModel with an integer property SelectedIndex. Changing the value of this property is an expensive operation, so I only want to update the property if ...
Harald Coppoolse's user avatar
2 votes
4 answers
2k views

WPF: Update button if text in TextBox changes

To learn WPF Command and CommandParameter I have a small WPF application with one TextBox and one Button. Whenever the button is pressed, ICommandTest should be called with the text of the text box as ...
Harald Coppoolse's user avatar
0 votes
1 answer
1k views

How to get property and call command from different ViewModel with mvvm pattern

I have a ViewModel with all the properties that i will need in every sub ViewModel. It's the first time i try to split commands and viewmodel to multiple files. Last time everything was in the same ...
MoneyMaker's user avatar
0 votes
1 answer
258 views

UWP - Command parameters are empty

I'm using RelayCommand which is implemented by Microsoft in their ICommand example. Here is a brief of my code. XAML: <TextBox x:Name="YoutubeUrlText" PlaceholderText="...
Kafka Wanna Fly's user avatar
0 votes
2 answers
235 views

WPF ICommand equivalent of Click -= Button_Click

For WPF ICommand, what is the equivalent of the event handler -=? We have a user control button that manages the function of submitting a purchase request but requires a user to register on the ...
Galactic's user avatar
  • 416
0 votes
1 answer
77 views

Command CanExecute not changing

This example isn't supposed to make sense, i'm just practicing. I have this command: public class NewCommand : ICommand { public event EventHandler CanExecuteChanged ...
AdmiralCat3's user avatar
1 vote
1 answer
519 views

ICommand is not executed in WPF application

I have a WPF application with a button which I bind to MessageCommand. In order to make it simple, the app only has a button which should display a messagebox. However, when I click the button, ...
Alex_P's user avatar
  • 2,750
0 votes
0 answers
43 views

WPF CommandParameter value is changing to null on execution [duplicate]

I am studying C# WPF and at the moment I am facing an issue. The app: I am playing around with the MVVM pattern. I have built a simple application that includes just -a ListView that displays a ...
Efthymios's user avatar
  • 253
1 vote
2 answers
2k views

Unit Testing ICommand and Methods

I have developed an WPF application using MVVM as a architecture and am writing some unit tests as part of this. In my view I have a button that is bound to a property in the ViewModel which can be ...
user avatar
0 votes
1 answer
2k views

Why is the WPF ApplicationCommands.Close command disabled on the button and in the menu item?

Question Why is the WPF ApplicationCommands.Close command disabled on the button and in the menu item? Code <Window x:Class="ApplicationCloseCommand.Views.MainWindow" xmlns="http://...
Lernkurve's user avatar
  • 20.7k
1 vote
1 answer
603 views

Xamarin Forms Command always null in custom control

I try to create a usercontrol. The user control will be a Button to show loader. I try to pass a binded command from my page to my control My XAML PAge is: <sharedviews:...
dalton5's user avatar
  • 925
0 votes
1 answer
335 views

WPF: ICommand, open a txt file in textbox

I have a little problem here , I have to open (read) a text file in a basic WPF notepad kind thing , but i have to do with ICommand interface. The problem is that when i chose the txt file i want to ...
Tibor's user avatar
  • 25

1
2 3 4 5
10