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.

ActivateItemAsync don´t work over Dependency Injection

See original GitHub issue

Description

I am trying to create a button which could change ContentControl View via ActivateItemAsync. After a lot of testing it looks like the view can´t be changed. After debugging I found out that the ActivateItemAsync value will be changed but the view just doesn´t change. I don´t even get a error or warning message. Is there a known Bug?

I´ve created a more detailed post here. A hint would be very nice.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
KasperSKcommented, Jul 17, 2021

I would try using an action message instead of injecting the ShellVM into the view. Like so: <Button Content="Click Me" cal:Message.Attach="[Event Click] = [Action SayHello(Name.Text)]" />

The reason it works when ShellVW is a singleton, is that you don’t get two instances of ShellVW.

Caliburn Micro sets the binding context for the UserControl so there should be no need to inject the ShellVW into the UserControl.

As for the warning I think that is a hard Caliburn Micro cannot guess about the intent of the user code.

0reactions
lgundcommented, Jul 19, 2021

Yea on normal redirection I would use the action but I need to translate also a full data object. I used the “A little Extended Implementation” from this post here. It´s the simplest way to use it and it´s also better readable. Maybe we find a better solution in the feature here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Caliburn Micro MVVM Multiple Active Items AND IoC ...
The biggest problem I ran into is, that I can't find a way to make the dependency injection, using a factory. The constructor...
Read more >
When is it not appropriate to use the dependency injection ...
Basically, dependency injection makes some (usually but not always valid) assumptions about the nature of your objects. If those are wrong, ...
Read more >
Qualms over the 'flexibility' advantage of using dependency ...
Your class (with the injectable dependencies) must use a base type or interface for its dependency. You can't just randomly inject any arbitrary ......
Read more >
Dependency injection - .NET
Learn how to use dependency injection within your .NET apps. Discover how to registration services, define service lifetimes, ...
Read more >
The Problem With Dependency Injection Frameworks
Let me be clear: I don't have a problem with dependency injection. One of my most popular articles is “Dependency Injection Demystified”, ...
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