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

The x:Key has no intellisense in XAML. #2564

chenyj796 opened this issue Feb 13, 2020 · 5 comments

The x:Key has no intellisense in XAML. #2564

chenyj796 opened this issue Feb 13, 2020 · 5 comments


Copy link

@chenyj796 chenyj796 commented Feb 13, 2020

  • .NET Core Version: 3.1.1
  • Windows version: 1909
  • Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
  • Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? If yes, please file the issue via the instructions here.
  • Security issues and bugs should be reported privately, learn more via our responsible disclosure guidelines.

Problem description:
I have a resource key defined as below:

namespace Wpf1
	public abstract class ResourceExtension : TypeExtension
		public ResourceExtension()
			this.Type = this.GetType();
		public override object ProvideValue(IServiceProvider serviceProvider)
			return this.Type;
	public class NormalBackground : ResourceExtension

And I use it in XAML as below:

            Color="Green" />
            Background="{StaticResource {local:NormalBackground}}" />

Actual behavior:
When I type the x:Key="{local:NormalBackground}", it has no intellisense, however when I type the Background="{StaticResource {local:NormalBackground}}", the intellisense works fine.

Expected behavior:
The x:Key also has intellisense.

Minimal repro:


This comment has been minimized.

Copy link

@gomathip02 gomathip02 commented Feb 13, 2020

@chenyj796 - The value of x:key is an arbitrary string and this is an expected behavior.

@gomathip02 gomathip02 closed this Feb 13, 2020

This comment has been minimized.

Copy link

@weltkante weltkante commented Feb 13, 2020

@gomathip02 I don't think thats a string, thats a markup extension isn't it? You should be able to expect intellisense for a markup extension.


This comment has been minimized.

Copy link

@miloush miloush commented Feb 14, 2020

@gomathip02 that is not even true, x:Key can be any arbitrary object and often it is not a string at all.

A typical example would be using type as a key for a style to apply it to all instances of the type: <Style x:Key="{x:Type TextBlock}">. You should definitely get an autocompletion list of available types in this case and I would think that used to be the case.


This comment has been minimized.

Copy link

@rladuca rladuca commented Feb 14, 2020

Sorry about that everyone, mistakes were made (don't blame @gomathip02).

Re-opening this. I am not sure if this will end up here in the long run. This seems like a VS issue since (I believe) that we are providing all the necessary information for intellisense to be enabled for x:Key.

Anyway, kicking this to triage again so we can better understand where the issue lies. And thanks for the corrections.

FYI: @SamBent @vatsan-madhavan

@rladuca rladuca reopened this Feb 14, 2020

This comment has been minimized.

Copy link

@gomathip02 gomathip02 commented Feb 18, 2020

@chabiss - This seems to be VS issue. Can you pls take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.