Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x:Bind inside a ResourceDictionary but outside a DataTemplate does not work #2573

Closed
matthew4850 opened this issue May 29, 2020 · 3 comments
Closed

Comments

@matthew4850
Copy link

Describe the bug
If you have a ResourceDictionary with a code-behind and you try to x:Bind one element to the property of another but are not inside a data template it will generate a bad g.cs file that does not compile. It seems to assume the ResourceDictionary is a FrameworkElement as it uses the Loading property.

Steps to reproduce the bug
Create a ResourceDictionary with a code-behind.
Then create two elements, one with an x:Name and the other binding to that x:Name.

Expected behavior
It successfully x:Binds.

Screenshots
Used xaml code.
image
Error inside generated .g.cs file
image

Version Info
MinSDK: 15063
TargetSDK: 18362

@msft-github-bot msft-github-bot added the needs-triage Issue needs to be triaged by the area owners label May 29, 2020
@stevenbrix stevenbrix added area-Binding area-XamlCompiler team-Markup Issue for the Markup team and removed needs-triage Issue needs to be triaged by the area owners labels May 29, 2020
@alexdi220
Copy link
Contributor

Hi @matthew4850
I've noticed that you used the x:Name instead of x:Key. Try to replace it.

@michael-hawker
Copy link
Collaborator

Is this related to #2508?

@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants