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

Issue when having ContentControl as Content in ContentControl #47

Closed
amerkoleci opened this issue May 5, 2015 · 5 comments
Closed

Issue when having ContentControl as Content in ContentControl #47

amerkoleci opened this issue May 5, 2015 · 5 comments

Comments

@amerkoleci
Copy link
Contributor

Maybe the title can be missleading but there is an issue with template create when having something like this:

var window = new Window()
{
  Content = new ContentControl
  {
      Content = new TreeView
      {
           Items = treeData
      }
  }
}
@grokys
Copy link
Member

grokys commented May 5, 2015

Could you tell me what the issue is? If I paste your code snippet into the Perspex TestApplication, it runs as expected.

@amerkoleci
Copy link
Contributor Author

I don't see the TreeView, if I remove the ContentControl and set it directly to Window Content it works.

@grokys
Copy link
Member

grokys commented May 5, 2015

Hmm I'm not seeing that, but I did have some unpushed changes here locally. Could you try pulling from git and trying again.

This is what I did to test:

  • Comment out the whole of the Window window = new Window declaration in TestApplication and replace it with your code above.
  • Comment out the block below var renderer = ((IRenderRoot)window).Renderer;
  • Run the program.

I get this:

image

@amerkoleci
Copy link
Contributor Author

Found the issue, I had custom control deriving from ContentControl as for IStyleable.StyleKey it was not founding the style key for my custom control, deriving from UserControl worked, would be fine to find style from base class if not found from current one.

@grokys
Copy link
Member

grokys commented May 5, 2015

Ok, great - the problem with automatically using the style for a base class instead of the most derived class is that at the point of style binding it's not known whether a style will be found or not. There may be a better way around this, but at the moment indeed it's recommended to derive from UserControl or set the style key in your derived class.

Thanks for working through the problem, I know it's not easy when the project is in this early stage!

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