我正在开发一个应用程序赢得手机7.因为我需要添加可点击的按钮(不是具体的数字)到网格动态和导航页面的一些信息到其他页面。添加自定义可点击按钮
任何机构可以帮助我,请....
私人无效buildThumbs(网格gridThumb,INT P){
int n; if (p % 3 == 0) n = p/3; else n = (p/3) + 1; GridLength height = new GridLength(100); for (int i = 0; i < n; i++) { RowDefinition rowDef = new RowDefinition(); rowDef.MinHeight = 100; gridThumb.RowDefinitions.Add(rowDef); } MovieThumb[,] thumb = new MovieThumb[n, 3]; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { Image ni=new Image(); ImageSourceConverter ims = new ImageSourceConverter(); ni.SetValue(Image.SourceProperty ,ims.ConvertFromString("/Images/book1.png")); thumb[i, j].SetValue(Grid.ColumnProperty, j); thumb[i,j].SetValue(Grid.RowProperty,i); thumb.Click += new RoutedEventHandler(thumb_click("sandy")); thumb[i, j].CoverImage = ni; thumb[i, j].Loading = "Loading"; thumb[i, j].progress = false; gridThumb.Children.Add(thumb); } }
}
我不能肯定,你想要做什么或你所要求的,但一些更多的信息,你可能想尝试WrapPanel(从Silverlight Toolkit [链接](http://silverlight.codeplex.com/releases/view/60291))而不是网格 - 动态添加项目要容易得多 – 1adam12
它可能在网格中动态地添加项目到一个wrappanel会更容易,但它的性能也较差。对于一些项目可以使用,但是当您需要添加更多的对象时,应该执行额外的工作并使用网格代替 – Anheledir