Skip to content

Commit

Permalink
Fixed behavior binding
Browse files Browse the repository at this point in the history
The binding context wasnt being set on the platform behavior. We will need to understand the impact of this going forwards, see CommunityToolkit#795
  • Loading branch information
Axemasta committed Mar 14, 2024
1 parent a272913 commit 5927843
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ public partial class TouchBehaviorViewModel : BaseViewModel

[ObservableProperty]
int longPressCount;

public TouchBehaviorViewModel()
{
}

[RelayCommand]
void ParentClicked()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ element is MView view &&
protected override void OnAttachedTo(VisualElement bindable, AView platformView)
{
Element = bindable;
BindingContext = Element.BindingContext;
view = platformView;
viewGroup = Microsoft.Maui.Platform.ViewExtensions.GetParentOfType<ViewGroup>(platformView);
if (IsDisabled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ protected override void OnAttachedTo(VisualElement bindable, UIView platformView
{
Element = bindable;

BindingContext = Element.BindingContext;

touchGesture = new TouchUITapGestureRecognizer(this);

if (((platformView as IVisualNativeElementRenderer)?.Control ?? platformView) is UIButton button)
Expand Down

0 comments on commit 5927843

Please sign in to comment.