Replies: 1 comment
-
if understanding you right, you need this to create a control where you can add views as Contexts: [ContentProperty("Contents")]
public partial class ColPageButtonLine : ContentView
{
private StackLayout ContentStack { get; } = [];
public StackLayout Contents => (StackLayout)ContentStack.Children;
public new ICollectionBaseViewModel BindingContext
{
get => (ICollectionBaseViewModel)base.BindingContext;
set => base.BindingContext = value;
}
public ColPageButtonLine()
{
// Content Presenter for additional buttons
Contents.Spacing = 5;
Contents.Orientation = StackOrientation.Horizontal;
Contents.VerticalOptions = LayoutOptions.End;
ContentPresenter contentPresenter = new()
{
Content = Contents.CenterHorizontal(),
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've created a ControlTemplate based on the RadioButton control in Maui. I'm interested in using a ContentPresenter to be able to reuse the control with several different button appearances. Unfortunately, there don't seem to be any examples of how to do this. I did find an example of an custom Accordion control where the author included a BindableProperty of type View as a way bind content to a custom control, though I've been unable to get this approach to work with my own control.
Below are some code snippets of what I've experimented with thus far. I figured out that I had to add the Content to the grid in my control within the propertyChanged: method of my BindableProperty and not in the constructor.
Any advice would be appreciated!
public partial class RadioButtonTemplate : RadioButton where T : ObservableObject {}
Beta Was this translation helpful? Give feedback.
All reactions