question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Conditional methods with parameters as actions?

See original GitHub issue

Hi @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:open
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
WillBellJrcommented, Jul 26, 2020

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!

1reaction
canton7commented, Jul 20, 2020

Ah no, doesn’t look like that works, sadly.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found