or
<
DataTemplate
x:Key
=
"doubleTemplate"
>
<
local:DoubleTextBox
propertyGrid:AutoBindBehavior.UpdateBindingOnElementLoaded
=
"Text"
/>
</
DataTemplate
>
<
DataTemplate
x:Key
=
"usrDoubleTemplate"
>
<
Grid
Name
=
"gridRoot"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
/>
<
ColumnDefinition
Width
=
"Auto"
/>
</
Grid.ColumnDefinitions
>
<
local:DoubleTextBox
propertyGrid:AutoBindBehavior.UpdateBindingOnElementLoaded
=
"Text"
/>
<
Label
Loaded
=
"LabelUnit_Loaded"
Grid.Column
=
"1"
Margin
=
"2,0"
ContentStringFormat
=
"[{0}]"
propertyGrid:AutoBindBehavior.UpdateBindingOnElementLoaded
=
"DataContext"
/>
</
Grid
>
</
DataTemplate
>
01.
Table table =
new
Table();
02.
table.StyleName = RadDocumentDefaultStyles.DefaultTableGridStyleName;
03.
TableRow headerRow =
new
TableRow();
04.
TableCell cornerCell =
new
TableCell();
05.
06.
Paragraph readOnlyPara =
new
Paragraph();
07.
ReadOnlyRangeStart range =
new
ReadOnlyRangeStart();
08.
range.AnnotationID = 1;
09.
readOnlyPara.Inlines.Add(range);
10.
cornercell.Blocks.Add(readOnlyPara);
11.
cornerCell.Background = Colors.LightGray;
12.
headerRow.Cells.Add(cornerCell);
13.
table.AddRow(headerRow);
14.
15.
//Add the column headers, which are an array of strings
16.
foreach
(
string
header
in
headers)
17.
{
18.
TableCell cell =
new
TableCell();
19.
cell.Background = Colors.LightGray;
20.
Paragraph p =
new
Paragraph();
21.
Span text;
22.
23.
//telerik paragraph cannot take empty span
24.
if
(String.IsNullOrEmpty(header))
25.
text =
new
Span(
" "
);
26.
else
27.
text =
new
Span(header);
28.
text.FontWeight = FontWeights.Bold;
29.
30.
p.Inlines.Add(text);
31.
cell.Blocks.Add(p);
32.
headerRow.Cells.Add(cell);
33.
}
34.
35.
//questions are an array of strings
36.
for
(
int
i = 0; i < questions.Length; i++)
37.
{
38.
//Add the first cell of each Row
39.
string
question = questions[i];
40.
TableRow row =
new
TableRow();
41.
TableCell cell =
new
TableCell();
42.
cell.Background = Colors.LightGray;
43.
Paragraph p =
new
Paragraph();
44.
45.
Span text =
new
Span(question);
46.
text.FontWeight = FontWeights.Bold;
47.
48.
p.Inlines.Add(text);
49.
cell.Blocks.Add(p);
50.
row.Cells.Add(cell);
51.
52.
//Add the remaining cells of the row for each header
53.
for
(
int
y = 0; y < headers.Length; y++)
54.
{
55.
string
header = headers[y];
56.
TableCell answerCell =
new
TableCell();
57.
Paragraph answerP =
new
Paragraph();
58.
//End the read only at the start of each answering row
59.
if
(y == 0)
60.
{
61.
ReadOnlyRangeEnd rangeEnd =
new
ReadOnlyRangeEnd();
62.
rangeEnd.AnnotationID = i + 1;
63.
answerP.Inlines.Add(rangeEnd);
64.
}
65.
66.
//Start the read only range at the end of the answering row.
67.
if
(y == headers.Length - 1 && i != questions.Length - 1)
68.
{
69.
ReadOnlyRangeStart rangestart =
new
ReadOnlyRangeStart();
70.
rangestart.AnnotationID = (i + 2);
71.
answerP.Inlines.Add(rangestart);
72.
}
73.
74.
answerCell.Blocks.Add(answerP);
75.
row.Cells.Add(answerCell);
76.
}
77.
78.
table.AddRow(row);
79.
}
80.
81.
section.Blocks.Add(table);