-
Notifications
You must be signed in to change notification settings - Fork 512
Description
Thanks for documenting FrameworkElement. Could you please explain how a derived class of FrameworkElement (or UIElement) can create visual child elements and/or render itself? How to create visual child elements without using a control template? I do realize that the documentation says "Typically, you don't derive classes directly from FrameworkElement", but occasionally it is necessary to derive directly from FrameworkElement, thus it would be greatly appreciated if you could explain how to do this, in particular the rendering or visual children part.
I understand that one option is to derive from Control instead of FrameworkElement and then use a control template, but sometimes templates are not the right solution for a particular UI element class, therefore how can we derive directly from FrameworkElement?
For comparison, in the older WPF-Desktop, a derived class could create visual child elements by overriding the following members, but these members do not exist in UWP, therefore how is it done in UWP?
System.Windows.FrameworkElement.VisualChildrenCountSystem.Windows.FrameworkElement.GetVisualChild(int)
Also in WPF-Desktop, a class could render itself by overriding System.Windows.UIElement.OnRender(System.Windows.Media.DrawingContext) but this method does not exist in UWP, therefore how is it done in UWP?
Thank you!
Document Details
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
- ID: b3d8cb6f-3b9e-ac4d-dcf1-723fc96024ea
- Version Independent ID: bbf98ac2-07d4-7897-245d-a5ba43c9abfe
- Content: FrameworkElement Class (Windows.UI.Xaml) - UWP app developer
- Content Source: https://cpubwin.visualstudio.com/DefaultCollection/windows-uwp/_git/winrt-api-build?path=%2fwinrt-api-build%2fwindows.ui.xaml.frameworkelement.yml&version=GBlive&_a=contents
- Product: windows
- Git Login: wdg-dev-content
- Microsoft Alias: wdg-dev-content