2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
You can bind the node item to CommandParameter in Xamarin.Forms SfTreeview by binding with dot.
C# ItemInfoCommand defined to get the node data in the ViewModel. public class FileManagerViewModel { public Command<object> NodeCommand { get; set; } public FileManagerViewModel() { NodeCommand = new Command<object>(OnNodeExecuted); } public void OnNodeExecuted(object data) { App.Current.MainPage.DisplayAlert("Alert", (data as FileManager).ItemName.ToString() , "OK"); } } XAML Binding (.) dot to CommandParameter of ViewModel command and will get the node data in the handler. <Grid Grid.Column=”1” RowSpacing="1" Padding="1,0,0,0" VerticalOptions="Center"> <Label LineBreakMode="NoWrap" TextColor="Black" Text="{Binding ItemName}" VerticalTextAlignment="Center"> </Label> <Button Grid.Column="1" HorizontalOptions="End" Text="Node Data" CommandParameter="{Binding . }" Command="{Binding Path=BindingContext.NodeCommand, Source={x:Reference treeView}}"/> </Grid> |
2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.