使用MVVM绑定AppBar事件
生活随笔
收集整理的這篇文章主要介紹了
使用MVVM绑定AppBar事件
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
最近在做一個(gè)項(xiàng)目,使用到MVVM,在appbar事件綁定時(shí)候發(fā)現(xiàn)不知道怎么綁定,查閱資料發(fā)現(xiàn)時(shí)可以綁定的,需要借助到AppBarUtils,可以到這里http://appbarutils.codeplex.com/下載到。
具體使用方法如下:
首先在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>轉(zhuǎn)載于:https://www.cnblogs.com/betterchaner/archive/2012/05/29/2523753.html
總結(jié)
以上是生活随笔為你收集整理的使用MVVM绑定AppBar事件的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: [zz]用U盘装win7/XP系统的操作
- 下一篇: 后IE6时代