I'm trying to find a control in my datacolumn's control template at run-time, so I can set the background color. What I had hoped to do is just set the gridviews alternating row background color, so I wouldn't have to do this, but it's not working. If you could either tell me how to reference the border control name "ItemBorder" at run-time so I can set it manually, or tell me how to set the gridviews alternating row background color correctly, I would appreciate it.
Here is the xaml for my RadGrid:
Here is the xaml for my RadGrid:
<
telerik:RadGridView
x:Name
=
"gvApplications"
RowIndicatorVisibility
=
"Collapsed"
ScrollViewer.HorizontalScrollBarVisibility
=
"Hidden"
AlternateRowBackground
=
"#DDDDDD"
AutoGenerateColumns
=
"false"
SelectionMode
=
"Single"
EditTriggers
=
"None"
ItemsSource
=
"{Binding Applications}"
RowDetailsVisibilityMode
=
"Collapsed"
ShowColumnHeaders
=
"False"
ShowGroupPanel
=
"False"
Width
=
"575"
HorizontalAlignment
=
"Left"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn.CellStyle
>
<
Style
TargetType
=
"telerik:GridViewCell"
>
<
Setter
Property
=
"Template"
>
<
Setter.Value
>
<
ControlTemplate
TargetType
=
"telerik:GridViewCell"
>
<
Border
x:Name
=
"ItemBorder"
BorderBrush
=
"#FFC2C2C2"
BorderThickness
=
"2, 1, 2, 1"
Width
=
"575"
HorizontalAlignment
=
"Left"
Background
=
"#DDDDDD"
Padding
=
"5"
Height
=
"101"
>
<
StackPanel
HorizontalAlignment
=
"left"
Margin
=
"0"
Background
=
"Transparent"
Width
=
"565"
>
<
Grid
Width
=
"565"
HorizontalAlignment
=
"Left"
Height
=
"65"
Background
=
"Transparent"
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"0.385*"
></
RowDefinition
>
<
RowDefinition
Height
=
"5"
></
RowDefinition
>
<
RowDefinition
Height
=
"0.615*"
></
RowDefinition
>
</
Grid.RowDefinitions
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"0.25*"
></
ColumnDefinition
>
<
ColumnDefinition
Width
=
"0.282*"
></
ColumnDefinition
>
<
ColumnDefinition
Width
=
"0.282*"
></
ColumnDefinition
>
<
ColumnDefinition
Width
=
"0.186*"
></
ColumnDefinition
>
</
Grid.ColumnDefinitions
>
<
TextBlock
x:Name
=
"tbStudentName"
Text
=
"{Binding Path=Student.FullName}"
Grid.Column
=
"0"
Grid.Row
=
"0"
></
TextBlock
>
<
TextBlock
x:Name
=
"tbAddress"
Text
=
"{Binding Path=Student.Address}"
Grid.Column
=
"0"
Grid.Row
=
"2"
VerticalAlignment
=
"Top"
Height
=
"34"
/>
<
TextBlock
Text
=
"Card #:"
Grid.Column
=
"1"
Grid.Row
=
"0"
Margin
=
"0,0,18,0"
></
TextBlock
>
<
TextBlock
x:Name
=
"tbCardNumber"
Text
=
"{Binding Path=Student.GiftCard.CardNumber}"
Grid.Column
=
"1"
Grid.Row
=
"0"
Margin
=
"44,0,8,0"
></
TextBlock
>
<
TextBlock
Text
=
"Amount:"
Grid.Column
=
"2"
Grid.Row
=
"0"
Margin
=
"8,0,-8,0"
></
TextBlock
>
<
TextBox
x:Name
=
"tbAmount"
Text
=
"{Binding Path=Funding.Amount}"
Grid.Column
=
"2"
Grid.Row
=
"0"
RenderTransformOrigin
=
"1.217,0.56"
Margin
=
"61,0,8,0"
/>
<
TextBox
x:Name
=
"tbComments"
Grid.Row
=
"2"
Grid.Column
=
"1"
Grid.ColumnSpan
=
"2"
Margin
=
"68,0,8,3"
></
TextBox
>
<
Button
Content
=
"Fund"
Click
=
"btnFund_Clicked"
Grid.Column
=
"3"
Grid.Row
=
"0"
Margin
=
"44,0,8,0"
RenderTransformOrigin
=
"0.95,0.48"
CommandParameter
=
"{Binding ApplicationID}"
Command
=
"{Binding FundCard}"
></
Button
>
<
TextBlock
Text
=
"Comments:"
Grid.Row
=
"2"
Grid.Column
=
"1"
Margin
=
"0,0,20,0"
Height
=
"15"
VerticalAlignment
=
"Top"
d:LayoutOverrides
=
"VerticalAlignment"
/>
</
Grid
>
<
Border
BorderThickness
=
"2"
BorderBrush
=
"#BFDF55"
Height
=
"24"
Margin
=
"0,0,5,0"
Background
=
"#F8FCDF"
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
Image
Source
=
"../Images/Check.png"
Height
=
"16"
Width
=
"16"
Margin
=
"5,0,0,0"
></
Image
>
<
TextBlock
x:Name
=
"tbActionText"
Text
=
""
></
TextBlock
>
</
StackPanel
>
</
Border
>
</
StackPanel
>
</
Border
>
</
ControlTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
telerik:GridViewDataColumn.CellStyle
>
</
telerik:GridViewDataColumn
>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>