2012年4月9日 星期一

ApplicationBar in Windows Phone 7 -1

創建ApplicationBar
Code-behind

Microsoft.Phone.Shell.ApplicationBar _ApplicationBar = new Microsoft.Phone.Shell.ApplicationBar (); Microsoft.Phone.Shell.ApplicationBarIconButton _Button = new Microsoft.Phone.Shell.ApplicationBarIconButton (new Uri ("/Icons/1.png", UriKind.Relative)); _Button.Text = "確定"; Microsoft.Phone.Shell.ApplicationBarIconButton _Button2 = new Microsoft.Phone.Shell.ApplicationBarIconButton (new Uri ("/Icons/2.png", UriKind.Relative)); _Button2.Text = "取消"; _ApplicationBar.Buttons.Add (_Button); _ApplicationBar.Buttons.Add (_Button2);

 this.ApplicationBar = _ApplicationBar;


Xaml


    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" x:Name="cApplicationBar" IsMenuEnabled="True">

            <shell:ApplicationBarIconButton x:Name="appbar_button4" IconUri="/Icons/1.png" Text=" 確定 " Click="appbar_button1_Click" />
            <shell:ApplicationBarIconButton x:Name="appbar_button1" IconUri="/Icons/2.png" Text=" 取消 " Click="appbar_button2_Click" />

        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

沒有留言:

張貼留言