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.

DesignTime support bindings getting weird

See original GitHub issue

I have an application that is split up in several libraries (containing views and models). However, the execution of the application is ok. This is the simple test result:

image

This shows a Container that has a property containing another Screen that needs to be resolved at runtime.

I have added two DesignTime ViewModels (one for Child and one for Container).

public class DesignContainerViewModel : Screen, IContainerViewModel
{
    public DesignContainerViewModel()
    {
        this.Text = "DesignTime Container";
        this.Child = new DesignChildViewModel(); // adding another DesignTimeViewModel manually
    }

    public string Text { get; set; }

    public IScreen Child { get; set; }
}

When selecting the ChildView everything seems to work:

image

When selecting the Container (with the ChildView inside):

image

The DesignViewModel for the Child can’t be resolved to the corresponding View. Sounds ok, cause there is no existing mapping (have to figure out how to replace “DesignTime” in namespace and “Design” in ViewModel name… however if I change the code above to contain the real model instead of the DesignTimeViewModel:

public class DesignContainerViewModel : Screen, IContainerViewModel
{
    public DesignContainerViewModel()
    {
        this.Text = "DesignTime Container";
        this.Child = new ChildViewModel(); // using real model in designtimeviewmodel now
    }

    public string Text { get; set; }

    public IScreen Child { get; set; }
}

… it looks like this:

image

nice… BUT WAIT… there is something wrong. There is written “DesignTime Container” in both labels but there should be “DesignTime Child” in the lower one.

public class DesignChildViewModel : Screen, IChildViewModel
{
    private readonly string text;

    public DesignChildViewModel()
    {
        this.text = "DesignTime Child"; // not shown!?
    }

    public string Text
    {
        get
        {
            return this.text;
        }
    }
}

I use VS 2013 and WPF for this. This is the sample to reproduce this behavior. CaliburnMicroDesignTimeSupport.zip

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
eogascommented, Oct 13, 2016

I think I’ve run into (essentially) this same issue. I have created a really basic reproducer here: https://github.com/eogas/CaliburnMicroDesignTimeNestedBindingBug

Basically it’s just a root window that contains a child view, which itself contains another child view. It takes a bit of building to get the XAML window to render everything, but once it’s stable, this is what I see.

ChildItemView

image

ItemView

image

ShellView

image

ItemView is able to render ChildItemView correctly as far as the hardcoded portions are concerned, however it doesn’t render the bindings to ChildItemViewModel. Similarly, in ShellView, we can see the hardcoded portions of ItemView, but its bindings, including the ChildItemView, are not resolved at design time.

But everything works fine at runtime: image

0reactions
nigel-sampsoncommented, Nov 9, 2016

@superware has created #388 to discuss it, feel free to add your ideas.

Read more comments on GitHub >

github_iconTop Results From Across the Web

x:Bind Design Time issues
Now the project is unusable, because designer throws weird exceptions, but when I Clean and Rebuild the project and navigate to the HomeView....
Read more >
View Loses data binding at design time
Hi I have been working on a view (created by the scaffolding wizard) which has had some extensive customisation. One of the things...
Read more >
Error XLS0413 in Xamarin.Forms project when specifying ...
I see the error XLS0413 in the Error List, saying “The property 'Value' was not found in type 'HeaderValueView'.” The weird thing is...
Read more >
Usable WPF Design-Time Data for .NET 5.0 (and 6.0)
I find design-time support essential for successful WPF view design, however much of it is broken with .NET 5.0. What to do? I...
Read more >
A Look Under the Hood of Windows Forms Data Binding
Easy design-time composition of user interfaces; effective support of complex scenarios of interrelated data, dependencies, and filtering. In Windows Forms ...
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