In the latest docs for RadioButton it says
When a ControlTemplate is applied to a RadioButton, a View can be assigned to the RadioButton.Content property on all platforms. For more information, see Redefine RadioButton appearance.
Doing so this produces a lot of warnings like this.
Microsoft.Maui.Controls.RadioButton: Warning: Warning - iOS does not support View as the Content property of RadioButton; the return value of the ToString() method will be displayed instead.
and
Microsoft.Maui.Controls.RadioButton: Warning: Warning - Android does not support View as the Content property of RadioButton; the return value of the ToString() method will be displayed instead.
This only appears when I set ControlTemplate AND Content when content is a View.
eg.
<RadioButton ControlTemplate="{StaticResource MyTemplate}">
<RadioButton.Content>
<Label Text="Test label" />
</RadioButton.Content>
</RadioButton>
If I only set ControlTemplate OR Content (or ControlTemplate with a string for Content) it does not cause an issue.
eg.
<RadioButton ControlTemplate="{StaticResource MyTemplate}" Content="Test text" />
...
<RadioButton>
<RadioButton.Content>
<Label Text="Test label" />
</RadioButton.Content>
</RadioButton>
This seems counter to what the documentation says. It almost seems like the documentation is wrong and "can be assigned" should be "can't be assigned"
This message seems to be coming from the ContentAsString method in RadioButton.cs. Oddly enough when you look at the two places it is called one is checking for ContentTemplate to be null and the other is checking for it to not be null.
This occours in .NET 9 (MAUI 9.0.120, limited to .NET SDK 9.0.305) and .NET 10 (MAUI 10.0.30, limited to .NET SDK 10.0.102).
Reproduction repo: https://github.com/beeradmoore/maui-issue-RadioButtonControlTemplateContent
In the latest docs for RadioButton it says
Doing so this produces a lot of warnings like this.
and
This only appears when I set
ControlTemplateANDContentwhen content is aView.eg.
If I only set
ControlTemplateORContent(orControlTemplatewith a string forContent) it does not cause an issue.eg.
This seems counter to what the documentation says. It almost seems like the documentation is wrong and "can be assigned" should be "can't be assigned"
This message seems to be coming from the
ContentAsStringmethod inRadioButton.cs. Oddly enough when you look at the two places it is called one is checking forContentTemplateto be null and the other is checking for it to not be null.This occours in .NET 9 (MAUI 9.0.120, limited to .NET SDK 9.0.305) and .NET 10 (MAUI 10.0.30, limited to .NET SDK 10.0.102).
Reproduction repo: https://github.com/beeradmoore/maui-issue-RadioButtonControlTemplateContent