MicrosoftDocs / windows-dev-docs

Conceptual and overview content for developing Windows apps
Creative Commons Attribution 4.0 International
694 stars 1.2k forks source link

XAML Use of Custom Panels #803

Open sjointer opened 6 years ago

sjointer commented 6 years ago

Would you please provide an example of this panel in use? How do I provide the name of the custom panel in XAML? Do I use the x:Name=, or x:Class= property? Or some other method? Don't most XAML classes have the keyword "partial" as part of the class declaration in order for the XAML to manipulate expose properties? Does XAML get access to the base class, or does it even need it?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

sjointer commented 6 years ago

Additionally, adding the refinement into the code didn't compile. I changed it to use the "UseSquareCells" property in the conditional, but that may not have been what was intended. Further, how does DependecyProperty.Register() accomplish it's task. I wasn't allowed to use the name it provided in my code, so I assume that property name is to be part of the XAML code...I think.

jevansaks commented 5 years ago

You would reference the panel like any other code-behind type. <local:BoxPanel> ... </>

anawishnoff commented 5 years ago

Adding onto above, UseSquareCells is a boolean value that allows you to set the value of the dependency property, or get the value of the dependency property - so using it in a conditional should be fine. That property name should be accessible from the XAML as well. DependencyProperty.Register simply initializes and adds a DependencyProperty onto a certain object type. More info here.