【发布时间】:2015-03-21 00:05:02
【问题描述】:
我正在使用 ImageCell 创建一个 ListView。我想在 ImageCell 单击时执行命令。但是,调试器不会调用 ViewModel 中的命令方法。 (我对按钮命令做同样的事情,这是有效的。)
查看:
<ListView x:Name="lvLocation" ItemsSource="{Binding LocationList}">
<ListView.ItemTemplate>
<DataTemplate>
<ImageCell ImageSource="edit.png" Height="40" Text="{Binding StoreName}" Detail="{Binding CityName}" Command="{Binding OnImageListCommand}" CommandParameter="{Binding CityName}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
查看模型:
public class ClassName: MvvmBaseClass
{
public ICommand OnImageListCommand { get; set; }
public ClassName()
{
OnImageListCommand = new Command<string>( OnImageListClick );
}
private void OnImageListClick(string _commandParamenter)
{
//Write code here.
}
}
【问题讨论】:
标签: xamarin xamarin.forms