mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-04-21 12:36:28 +02:00
Version 3.0.255
This commit is contained in:
parent
db9c288584
commit
5a26bf273b
1495 changed files with 159465 additions and 5060 deletions
35
LastenradBayern/TINK/View/ListViewAttachedBehavior.cs
Normal file
35
LastenradBayern/TINK/View/ListViewAttachedBehavior.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Windows.Input;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace TINK.View
|
||||
{
|
||||
public static class ListViewAttachedBehavior
|
||||
{
|
||||
public static readonly BindableProperty CommandProperty =
|
||||
BindableProperty.CreateAttached(
|
||||
"Command",
|
||||
typeof(ICommand),
|
||||
typeof(ListViewAttachedBehavior),
|
||||
null,
|
||||
propertyChanged: OnCommandChanged);
|
||||
|
||||
static void OnCommandChanged(BindableObject view, object oldValue, object newValue)
|
||||
{
|
||||
var entry = view as ListView;
|
||||
if (entry == null)
|
||||
return;
|
||||
|
||||
entry.ItemTapped += (sender, e) =>
|
||||
{
|
||||
var command = (newValue as ICommand);
|
||||
if (command == null)
|
||||
return;
|
||||
|
||||
if (command.CanExecute(e.Item))
|
||||
{
|
||||
command.Execute(e.Item);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue