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

Can't have two instances on a page with different languages #58

Closed
calloncampbell opened this issue Jul 26, 2021 · 5 comments
Closed

Can't have two instances on a page with different languages #58

calloncampbell opened this issue Jul 26, 2021 · 5 comments
Milestone

Comments

@calloncampbell
Copy link

When I try to use different instances on a page control, both are set to the same language. Say the first instance is SQL and the second is JSON, when I run the app they're both JSON.

@hawkerm
Copy link
Owner

hawkerm commented Jul 28, 2021

Hey @calloncampbell are you setting the CodeLanguage property or setting the Options with the Language? And in XAML or code-behind?

This could be related to #53 and #21

@hawkerm
Copy link
Owner

hawkerm commented Jul 28, 2021

I was able to reproduce locally, at least with a packaged version. Going to see if I can test in debug and try and see what's going on. Will try setting with options over CodeLanguage and see if that makes a difference

@hawkerm hawkerm added this to the v0.9-beta milestone Jul 29, 2021
@calloncampbell
Copy link
Author

calloncampbell commented Jul 29, 2021

Hi @hawkerm I was setting the CodeLanguage in XAML.

I'll give the Options way a try and let you know.

@hawkerm
Copy link
Owner

hawkerm commented Oct 25, 2021

Have it reproducing in the test app in the debugger. Definitely seems like the two editors are sharing an Options instance. Why that is, I'm not sure yet.

@hawkerm
Copy link
Owner

hawkerm commented Oct 25, 2021

Staring right in the face:

public static DependencyProperty OptionsProperty { get; } = DependencyProperty.Register(nameof(Options), typeof(StandaloneEditorConstructionOptions), typeof(CodeEditor), new PropertyMetadata(new StandaloneEditorConstructionOptions(), (d, e) =>

This creates a single object of the Options which is used for the default value for every control. Need to switch to PropertyMetadata.Create factory method to create a default value callback to create a new instance for each editor. Though tracking down other issues this is creating now for some reason...

hawkerm added a commit that referenced this issue Oct 25, 2021
Now each editor has its own options object created.
@hawkerm hawkerm closed this as completed Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants