Conditional methods with parameters as actions?
See original GitHub issueHi @canton7,
Thanks for this awesome library, I have been using it and I just love how simple and powerful it is.
On caliburn you can use methods with parameters for conditions(for reference: https://caliburnmicro.com/documentation/actions#action-parameters), say
public bool CanDoSomething(string name)
{
return !string.IsNullOrWhiteSpace(name);
}
public void DoSomething(string name)
{
// do something
}
From what I read on the documentation with Stylet that is not possible with a method or taking a parameter.
I could probably do a hacky approach which would involve binding 2 properties to achieve something close to the above but its no ideal.
Do you have any plans on adding that into Stylet or have I missed something and that is indeed possible?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
GitHub Actions: Conditional parameter value for custom ...
1 Answer 1 ... You can use the "steps.if", as the docs suggest: You can use the if conditional to prevent a step...
Read more >Passing a condition as a function parameter? : r/learnpython
I am writing a program that reads a bunch of animals from a file and appends them to a list depending on a...
Read more >Invoking methods based on a parameter without if-else ...
Invoking methods based on a parameter without if-else statements in C#. Simplify conditional code using the "delegate dictionary" pattern.
Read more >Conditional Formatting with Field Parameters in Power BI???
You are excited about Field Parameters in Power BI, but then realize you can't use conditional formatting with them. What the french toast!...
Read more >Dynamic class instancing (with conditional parameters and ...
Many of them will be simple static information (weight, value, etc.), but others will have conditionally defined parameters, with not only ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I agree, thanks Canton7 for taking the time to look into this suggestion.
I’m not new to MVVM, but always struggled with what I was using (mostly DevExpress MVVM) - I’ve been successfully using Stylet_ now for a couple of projects, AND I have to say, Stylet has finally made using MVVM with my WPF apps so much easier.
I look forward to ANY additions to this project!
Ah no, doesn’t look like that works, sadly.