Home > database >  Xamarin Forms Can Draw ContentPage On ContentPage?
Xamarin Forms Can Draw ContentPage On ContentPage?

Time:11-16

enter image description here

I want Draw Other ContentPage On ContentPage Like Parent And Child Relationship.

Xamarin Can This?

CodePudding user response:

how can I draw ContentView in a ContentPage?

From document Xamarin.Forms ContentView,we can know:

The Xamarin.Forms ContentView class is a type of Layout that contains a single child element and is typically used to create custom, reusable controls. The ContentView class inherits from TemplatedView.

The ContentView class defines a single property:

Content is a View object. This property is backed by a BindableProperty object so it can be the target of data bindings. The ContentView also inherits a property from the TemplatedView class:

ControlTemplate is a ControlTemplate that can define or override the appearance of the control.

The ContentView class can be used to create a custom control.

The process for creating a custom control is to:

  1. Create a new class using the ContentView template in Visual Studio 2019.
  2. Define any unique properties or events in the code-behind file for the new custom control.
  3. Create the UI for the custom control.

For more details, you can check:https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/contentview .

And there is also a sample included in above document , you can check it here:https://docs.microsoft.com/en-us/samples/xamarin/xamarin-forms-samples/userinterface-contentviewdemos/ .

  • Related