Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xamarin形式-XAML绑定的c#等价物_Xamarin_Xamarin.forms - Fatal编程技术网

Xamarin形式-XAML绑定的c#等价物

Xamarin形式-XAML绑定的c#等价物,xamarin,xamarin.forms,Xamarin,Xamarin.forms,我想将以下XAML转换为使用C#中定义的自定义ViewCell 所以转换后我有 而C# public分部类主页面:ContentPage { 公共主页() { 初始化组件(); ___listview.ItemsSource=Repository.GetList(); ___listview.ItemTemplate=新数据模板(typeof(CustomViewCell)); } } 公共类CustomViewCell:ViewCell { bool _initialized=fals

我想将以下XAML转换为使用C#中定义的自定义ViewCell


所以转换后我有


而C#

public分部类主页面:ContentPage
{
公共主页()
{
初始化组件();
___listview.ItemsSource=Repository.GetList();
___listview.ItemTemplate=新数据模板(typeof(CustomViewCell));
}
}
公共类CustomViewCell:ViewCell
{
bool _initialized=false;
公共CustomViewCell()
{
var stack=新的StackLayout();
var按钮=新按钮();
stack.Children.Add(按钮);
视图=堆栈;
}
}
在按钮的
图像
命令
属性上完成绑定语法所需的代码是什么

var button = new Button();
button.SetBinding(Button.ImageProperty, new Binding("ImageName"));
button.SetBinding(Button.CommandProperty, new Binding("ShowDetailsCommand"));