Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/6.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.ios 升级自定义视图列表mvvmcross touch_Xamarin.ios_Mvvmcross - Fatal编程技术网

Xamarin.ios 升级自定义视图列表mvvmcross touch

Xamarin.ios 升级自定义视图列表mvvmcross touch,xamarin.ios,mvvmcross,Xamarin.ios,Mvvmcross,您好,我正在尝试将ios应用程序从mvvmcrossv1升级到v3。我不知道如何使我的自定义按钮现在工作 我的视图ViewDidLoad绑定到按钮行的是按钮项 public override void ViewDidLoad() { base.ViewDidLoad(); SortingView.ViewModel=ViewModel; _显示=假; //设置视图动画 Buttons.OnClick=()=>{AnimationTransition=ViewTransitionAnimation

您好,我正在尝试将ios应用程序从
mvvmcross
v1
升级到
v3
。我不知道如何使我的自定义按钮现在工作

我的视图
ViewDidLoad
绑定到按钮行的是按钮项

public override void ViewDidLoad()
{
base.ViewDidLoad();
SortingView.ViewModel=ViewModel;
_显示=假;
//设置视图动画
Buttons.OnClick=()=>{AnimationTransition=ViewTransitionAnimation.TransitionFade;};
右上角按钮,触地+=
(发送方,args)=>{
AnimationTransition=ViewTransitionAnimation.TransitionCrossDissolve;
};
//设置绑定
这是AddBindings(
新词典
{
{this.BackgroundImage,“{'ImageData':{'Path':'BackgroundImage','Converter':'ImageItem'}}”,
{this.TopbarBackground,“{'ImageData':{'Path':'TopBarImage','Converter':'ImageItem'}},
{this.TopLogo,“{'ImageData':{'Path':'Logo','Converter':'ImageItem'}}”,
{this.Buttons,“{'ItemsSource':{'Path':'ButtonItems'}}”,
{this.SlideMenu,“{'ItemsSource':{'Path':'VisibleViews'}}”,
{
这是SortingView,
“{'ItemsSource':{'Path':'CategoriesName'},'SelectedGroups':{'Path':'SelectedGroups'},'ForceUbracoUpdateAction':{'Path':'ForceUbracoUpdateAction'}”
},
{this.setingsbutton,“{'touchtdown':{'Path':'TopRightButtonClick'},'Hide':{'Path':'HideTopbarButton'},'ImageData':{'Path':'TopButtonImage','Converter':'ImageItem'},},
{this.TopRightButton,“{'touchtdown':{'Path':'secondaryButtonButtonButtonPushed'},'Hide':{'Path':'HideTopbarButton2'},'ImageData':{'Path':'SettingsButtonImage','Converter':'ImageItem'}
});
//加载视图后,通常从nib执行任何附加设置。
NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidBecomeActiveNotification,ReEnableSlideMenu);
this.SortingView.Hidden=true;
ViewModel.SettingButtonEvent+=手柄设置按钮按下;
}
这是我的自定义控件“ButtonRow”

[寄存器(“按钮箭头”)]
公共类按钮箭头:CustomListViewController
{
私有整数_宽度=0;
私有UIImage _backgroundImage=null;
公用按钮箭头(IntPtr手柄)
:底座(手柄)
{
_宽度=(int)this.Frame.width;
UseMageAsicon=false;
FontSize=0;
}
公共bool useMageAsicon{get;set;}
公众形象背景形象
{
获取{return\u backgroundImage;}
设置{u backgroundImage=value;}
}
公共整数字体大小
{
获得;设置;
}
私人行动(onclick Action);;
私有int_间距=0;
公共行动点击
{
得到
{
返回_onclick动作;
}
设置
{
_onclick动作=值;
}
}
/// 
///添加视图。
/// 
///用于向按钮行添加视图的自定义实现
受保护的覆盖void AddViews()
{
if(ItemsSource==null)
{
隐藏=真实;
返回;
}
base.AddViews();
foreach(子视图中的UIView UIView)
{
uiView.RemoveFromSuperview();
}
如果(ItemsSource.Count==0)
{
隐藏=真实;
返回;
}
如果(_backgroundImage!=null)
{
var frame=新矩形F(0,0,帧宽度,帧高度);
var background=newuiimageview(frame){Image=\u backgroundImage};
添加子视图(背景);
}
_宽度=_宽度-((ItemsSource.Count-1)*间距);
var buttonWidth=(int)Math.天花((双精度)宽度)/ItemsSource.Count;
int指数=0;
foreach(ItemsSource中的ViewItemModel项)
{
//在类构造函数中加载使用所需的viewmodel、nib等创建自定义按钮
var按钮=带标签的新按钮(项目,单击);
如果(字体大小>0)
{
按钮。FontSize(FontSize);
}
如果(使用ImageAsicon)
{
button.AddBindings(
新词典
{
{按钮,{'IconLabel':{'Path':'Title'},'TitleFontColor':{'Path':'TitleFontColor'}},
{button.icon,“{'ImageData':{'Path':'ImageIcon','Converter':'ImageItem'}}”
});
}
其他的
{
//在按钮及其viewmodel之间创建的绑定
button.AddBindings(
新词典
{
{按钮,{'Label':{'Path':'Title'},'TitleFontColor':{'Path':'TitleFontColor'},'BackgroundColor':{'Path':'BackgroundColor'}},
{button.Background,“{'ImageData':{'Path':'ImageIcon','Converter':'ImageItem'}}”
});
button.icon.Hidden=true;
}
//设置按钮的新框架,因为按钮的数量是动态的
INTX=索引==0?0:索引*(按钮宽度+间距);
button.SetFrame(新矩形F(x,0,buttonWidth,Frame.Height));
//按钮的视图将添加到buttonrow视图中
AddSubview(按钮视图);
索引++;
}
}
公共整数间距
{
得到
{
返回此值。\u间距;
}
设置
{
这是。_间距=值;
}
}
受保护的覆盖无效处置(布尔处置)
{
基地。处置(处置);
}
公共覆盖无效清除()
{
if(子视图!=null)
{
foreach(子视图中的变量视图)
{
view.RemoveFromSuperview();
}
}
如果(_backgroundImage!=null)
{