I am having a Custom Control, I want to add some elements from the Page in which it will be used.
Just like this
<Label>
<Label.Text>First Name</Label.Text>
</Label>
As here, Label
is predefined, and Label
's Text property is added in other Page ie. where it is being used, I want to add controls whose values will be assigned from another Page in which, it will be used.
Here's my Custom Control in XAML (DialogView.xaml)
<?xml version="1.0" encoding="UTF-8"?>
<ContentView ...>
<ContentView.Content>
<Frame x:Name="dialogContainer" Padding="0" BackgroundColor="Transparent">
<!--I want to use this StackLayout below and add controls inside it from other Page's XAML-->
<StackLayout x:Name="ChildStackLayout" x:FieldModifier="public" />
</Frame>
</ContentView.Content>
</ContentView>
Here's how I am utilizing it (MainPage.xaml)
<controls:DialogView>
<controls:DialogView.ChildStackLayout>
<!--Here I want to add controls in my Custom Control-->
<Label Text="Hello, this is a custom dialog" />
</controls:DialogView.ChildStackLayout>
</controls:DialogView>
But ChildStackLayout
is not accessible in other Page