You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm still new in .NET MAUI so I still have some problems with basic concepts and best practices. Currently I'm struggling a bit with ContentPresenter.
So I have a custom component (ContentView) with ControlTemplate that uses ContentPresenter. Let us name this CustomControl.xaml
where DoSomethingCommand is defined in my view model.
And this works perfectly fine, awesome! But what if I want to use multiple ContentPresenters in my CustomControl? As far as I know, I should bind content of ContentPresenter like this:
And my button shows up exactly where it should, but... there is absolutely no effect when clicking on it :( I searched for a solution and I found out that I can use it like that:
And that indeed works, but it looks awful and I don't understand it at all :( Could anyone please help me understand why this simple binding to my command doesn't work? Maybe I can/should modify somehow my CustomControl?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello, I'm still new in .NET MAUI so I still have some problems with basic concepts and best practices. Currently I'm struggling a bit with
ContentPresenter
.So I have a custom component (
ContentView
) withControlTemplate
that usesContentPresenter
. Let us name thisCustomControl.xaml
Obviously I'm using MVVM so when I want to use
CustomControl
in a view I do this:where
DoSomethingCommand
is defined in my view model.And this works perfectly fine, awesome! But what if I want to use multiple
ContentPresenter
s in myCustomControl
? As far as I know, I should bind content ofContentPresenter
like this:Of course I've defined
BindableProperty
in my code-behind file. And now I'm using myCustomControl
like this:And my button shows up exactly where it should, but... there is absolutely no effect when clicking on it :( I searched for a solution and I found out that I can use it like that:
And that indeed works, but it looks awful and I don't understand it at all :( Could anyone please help me understand why this simple binding to my command doesn't work? Maybe I can/should modify somehow my
CustomControl
?Beta Was this translation helpful? Give feedback.
All reactions