在Windows手机页面中制作图像按钮 [英] Make image button in windows phone page

查看:92
本文介绍了在Windows手机页面中制作图像按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在visual studio 2010中创建图像按钮,但是我无法将图像按钮拖动到xaml以创建带代码的图像按钮手册,你能帮我修复代码吗?你帮我修复代码?

这里的代码





private void Add(ref Image img,int Row,int Column)

{

按钮_btn =新按钮();

_btn.Click + = Button_Click;

_btn。 Content = null;

_btn.Margin = new Thickness(-7); // memperbesar margin kotak

//图片img = new Image();





_btn.SetValue(Image.SourceProperty,Column);

_btn.SetValue(Image.SourceProperty,Row);

GambarnyaObj = Gambarnya.ElementAt< listmemorygame>(idx);

image1.Source = new BitmapImage(new Uri(@ GambarnyaObj.SOAL,UriKind.Absolute));

// textBlock1.Text = GambarnyaObj.KET;

// this.pg1.IsIndeterminate = false;

// textBlock2.Visibility = Visibility.Collapsed; *

//Grid.Children.Add(_btn);





}



private void布局(ref Grid Grid)// menampilkan kotak

{

Grid.Children.Clear();

Grid.ColumnDefinitions.Clear();

Grid.RowDefinitions.Clear();

//设置4x4网格

for(int指数= 0; (指数< = 3);索引++)

{

Grid.RowDefinitions.Add(new RowDefinition());

Grid.ColumnDefinitions.Add(new ColumnDefinition()) ;

}

添加(0,0); // jumlah kotak yg ada keterangan berdasarkan matrix bariss& kolom

添加(0,1);

添加(0,2);

添加(0,3);

添加(1,0);

添加(1,1);

添加(1,2);

添加(1,3);

添加(2,0);

添加(2,1);

添加(2,2) ;

添加(2,3);

添加(3,0);

添加(3,1);

添加(3,2);

添加(3,3);



}

i want to create image button in visual studio 2010, but i can't drag image button to xaml to create image button manual with a code, can you help me to fix the code?n you help me to fix the code?
here the code


private void Add(ref Image img, int Row, int Column)
{
Button _btn = new Button();
_btn.Click += Button_Click;
_btn.Content = null;
_btn.Margin = new Thickness(-7);//memperbesar margin kotak
//Image img = new Image();


_btn.SetValue(Image.SourceProperty, Column);
_btn.SetValue(Image.SourceProperty, Row);
GambarnyaObj = Gambarnya.ElementAt<listmemorygame>(idx);
image1.Source = new BitmapImage(new Uri(@GambarnyaObj.SOAL, UriKind.Absolute));
// textBlock1.Text = GambarnyaObj.KET;
// this.pg1.IsIndeterminate = false;
// textBlock2.Visibility = Visibility.Collapsed;*
//Grid.Children.Add(_btn);


}

private void Layout(ref Grid Grid) // menampilkan kotak
{
Grid.Children.Clear();
Grid.ColumnDefinitions.Clear();
Grid.RowDefinitions.Clear();
// Setup 4x4 Grid
for (int Index = 0; (Index <= 3); Index++)
{
Grid.RowDefinitions.Add(new RowDefinition());
Grid.ColumnDefinitions.Add(new ColumnDefinition());
}
Add( 0, 0); // jumlah kotak yg ada keterangan berdasarkan matrix bariss & kolom
Add( 0, 1);
Add( 0, 2);
Add( 0, 3);
Add( 1, 0);
Add( 1, 1);
Add( 1, 2);
Add( 1, 3);
Add( 2, 0);
Add( 2, 1);
Add( 2, 2);
Add( 2, 3);
Add( 3, 0);
Add(3, 1);
Add(3, 2);
Add(3, 3);

}

推荐答案

http://stackoverflow.com/questions/24386125/adding-custom-imagebutton-control-to-windows-phone-proyect?answertab=active#tab-top [ ^ ]


这篇关于在Windows手机页面中制作图像按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆