Hi guys,
I happened to come across this article https://devblogs.microsoft.com/dotnet/winforms-cross-platform-dotnet-maui-command-binding/ describing the new Winforms binding infrastructure in .NET 7. I was wondering whether the Commanding introduced in Wisej 3.1 is compatible with this, or if you are planning to go this way. In particular, in WinForms there is a new CommandParameter property for the ButtonBase and ToolStripItem that seems to be missing from Wisej. I saw a CommandArgs class in the Wisej Documentation, but how is this associated to the button?
Regards,
Alex
Hi Alex,
Sorry about that!
The CommandArgs class has the CommandSource property, which in turn can be cast to a Control and you can then get the Tag property from there.
Look at the DataRecord class in the new attached sample.
HTH,
Alaa
Hi Alaa,
Thanks for your sample. But this does not answer my original question, i.e. how is the pressed Button associated with the CommandArgs. To make it clearer, think of a form with two buttons, Button1 and Button2 bound to the same command. How do I pass, for example, the Tag of each button to the Command so that the command knows it has to perform a different action according to the button that was pressed?
Best,
Alex
Hi Alex,
I have attached a sample that demonstrates how to use the CommandArgs in Wisej.
HTH,
Alaa
Please login first to submit.