Maui TapGestureRecognizer Command working in View but not working in viewModel. #33376
Replies: 2 comments 6 replies
-
|
Try something like that. ...assuming that you have xmlns for your viewmodel |
Beta Was this translation helpful? Give feedback.
-
<?xml version="1.0" encoding="utf-8"?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:bindingContext="using:MauiLab.ViewModels.BindingContext"
xmlns:bindingContext1="using:MauiLab.Views.BindingContext"
xmlns:sys="clr-namespace:System;assembly=netstandard"
x:Class="MauiLab.Views.BindingContext.BindingContextView"
x:DataType="bindingContext:BindingContextViewViewModel">
<VerticalStackLayout>
<Button Text="View Button"
Command="{Binding ExecuteCommand}" />
<Label Text="{Binding IsEnableView}"
TextColor="White"
FontSize="20" />
<bindingContext1:BindingContextGrid/>
<CollectionView>
<CollectionView.ItemsSource>
<x:Array Type="{x:Type bindingContext:BindingContextGridViewModel}">
<bindingContext:BindingContextGridViewModel/>
<bindingContext:BindingContextGridViewModel/>
</x:Array>
</CollectionView.ItemsSource>
<CollectionView.ItemTemplate>
<DataTemplate x:DataType="bindingContext:BindingContextGridViewModel">
<bindingContext1:BindingContextGrid/>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ContentView>now i am using the ContentView ViewMode as a ItemSource and inside that ViewMode have |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
UserCommandItemView.xml
UserCommandItemView.xaml.cs
DesignUserCommandViewModel.cs
2026-01-06.00-13-07.mp4
The TapGestureRecognizer command working correctly in (code-behind)view but not working in viewmodel.
I wand to Execute the LoadReply method in DesignUserCommandViewModel Class using TapGestureRecognizer Command.
Beta Was this translation helpful? Give feedback.
All reactions