-
Hi everyone, I'm facing an issue with data binding in my custom MAUI component. I have a custom control with field ( Here is the relevant part of my custom component's XAML: <Entry Text="{Binding Text, Source={x:Reference this}}" /> And here is the code-behind for the custom component: public partial class MyCustomControlView : ContentView
{
public static readonly BindableProperty TextProperty =
BindableProperty.Create(nameof(Text), typeof(string), typeof(MyCustomControlView), default(string), BindingMode.TwoWay);
public string Text
{
get => (string)GetValue(TextProperty);
set => SetValue(TextProperty, value);
}
// Other methods and event handlers...
} And here is how I use the custom component in my main view: <avControls:MyCustomControlView Text="{Binding ViewModelTextField}" /> Despite setting the binding mode to Thank you in advance for your assistance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
maybe ViewModelTextField is not observable? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
I think you have to set the bindingcontext in you customcontrol, not the source