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
Originally posted by smalec May 2, 2024
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?
The text was updated successfully, but these errors were encountered:
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
I have the same problem.
I thought that fix #12536 would solve it, but I have just updated VS to version 17.11.2 and it still does not work.
See the attached test app. TestMauiAppBindings.zip
If I made a mistake in the controls, please let me know.
Reporting this as bug, since it looks fairly similar to #12470
Discussed in #22161
Originally posted by smalec May 2, 2024
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
?The text was updated successfully, but these errors were encountered: