WP8.SDk 용 테이블을 만들어야합니다.동적으로 생성 된 격자의 행 배경 설정
저는이 목적으로 그리드를 사용하고 있습니다. 행과 열의 동적 그리드를 만들었습니다.
는 지금은
내 C# 코드가 여기에있다 .. 헤더 다른 만들기 위해 배경 이미지를 설정합니다. 이 같은
private void table_click(object sender, RoutedEventArgs e)
{
//Creation of Grid
Grid tablegrid = new Grid();
tablegrid.Height = double.NaN;
tablegrid.Width = 454;
tablegrid.Margin = new Thickness(0, 66, 0, 0);
tablegrid.ShowGridLines = true;
tablegrid.VerticalAlignment = System.Windows.VerticalAlignment.Top;
tablegrid.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
//Table Rows and Columns Definition
string[] tablerow = new string[] { "Submit Report", "Something", "New" };
string[] tablecol = new string[] { "Mansab", "Arsal", "Ali" };
int i, j;
for (i = 0; i < tablerow.Length; i++)
{
RowDefinition gridrows = new RowDefinition();
gridrows.Height = new GridLength(66);
if (i == 0)
{
var brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri("Resources/Images/top_bar_bg.png", UriKind.Relative));
//gridrows.Background = brush; //This not works
}
tablegrid.RowDefinitions.Insert(i, gridrows);
}
for (j = 0; j < tablecol.Length; j++)
{
ColumnDefinition gridCol = new ColumnDefinition();
tablegrid.ColumnDefinitions.Insert(j, gridCol);
}
tablegrid.ShowGridLines = true;
ContentPanel.Children.Add(tablegrid);
}
내 테이블의 모양을
http://www.4shared.com/download/SlNX8mbpba/Table.PNG
하지만 난이 이런 식으로 뭔가를 만들기 위해 :
http://www.4shared.com/download/j-qT-kGVce/table2.PNG
어떻게 동적으로 각 행의 배경을 지정할 수 있습니다?
Windows Phone 8 SDK에 대해 DataGrid를 사용할 수 없습니다. 여기 그리드입니다. 이걸 테이블로 사용하려고합니다. 헤더에 대한 배경 이미지가 필요합니다. 헤더에 대해이 작업을 수행 할 수 있다면 모든 행과 열을 넣을 수 있습니다 ..하지만 여기서는 제가 할 수 없습니다 .. 그래서이 문제를 해결할 수 있습니까? – Arsal