当前位置: 移动技术网 > IT编程>移动开发>WP > 使用MVVM绑定AppBar事件

使用MVVM绑定AppBar事件

2018年09月30日  | 移动技术网IT编程  | 我要评论

财务管理试题及答案,win 10 下载,斗战神戈游虫

最近在做一个项目,使用到mvvm,在appbar事件绑定时候发现不知道怎么绑定,查阅资料发现时可以绑定的,需要借助到appbarutils,可以到这里下载到。


具体使用方法如下:

首先在xmal中添加引用

xmlns:appbar="clr-namespace:appbarutils;assembly=appbarutils"
xmlns:i="clr-namespace:system.windows.interactivity;assembly=system.windows.interactivity"
然后viewmodel重添加command


/// <summary>
/// 刷新command
/// </summary>
public icommand refreshcommand
{
            get;
            set;
 }

最后在xmal中添加appbar的绑定


<phone:phoneapplicationpage.applicationbar>
     <shell:applicationbar isvisible="true" ismenuenabled="true">
        <shell:applicationbariconbutton iconuri="/resource/icons/appbar.refresh.png" text="refresh"/>
     </shell:applicationbar>
</phone:phoneapplicationpage.applicationbar>
<i:interaction.behaviors>
   <appbar:appbaritemcommand id="refresh" text="刷新" command="{binding path=refreshcommand}"></appbar:appbaritemcommand>
</i:interaction.behaviors>

 


摘自 better.chaner
 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网