I have the following ContentView:
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ValidationLibrary.ValidationFor"
x:Name="this">
<ContentView.Content>
<Grid RowDefinitions="Auto, *">
<ContentPresenter x:Name="chiledContainer" Grid.Row="0" />
<Label Text="{Binding ErrorMessage, Source={x:Reference this}}"
IsVisible="{Binding IsValid, Source={x:Reference this}}"/>
</Grid>
</ContentView.Content>
</ContentView>
In the code behind I need to access the first child in the ContentPresenter.
Exemple usege is below:
<validation:ValidationFor FieldName="Name">
<Entry x:Name="Name" Text="{Binding Name, Mode=TwoWay, UpdateSourceEventName=PropertyChanged}" />
</validation:ValidationFor>
Anything I tried I did not work. I could access the grid, contentpresenter, label but not the child or any element of the content presenter.
thnx