开发者

Button command in windows phone 7

I am trying to use code the button click command programmatically but i am not sure how to do it.

I want som开发者_如何转开发ething like when click on the button it will do something.

Below is my code for the button:

HyperlinkButton viewButton = new HyperlinkButton();

                viewButton.Margin = new Thickness(-150, 20, 0, 0);
                viewButton.Width = 100;
                viewButton.Height = 50;
                viewButton.Name = songTitle;
                viewButton.Background = new ImageBrush { ImageSource = new BitmapImage(new Uri("/AlarmClock;component/Images/music_note.png", UriKind.Relative)) };
                viewButton.FontSize = 30;


It is going to be a standard event handler:

viewButton.Click += new RoutedEventHandler(viewButton_Click);

private void viewButton_Click(object sender, RoutedEventArgs e)
{
    // Action here.
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜