如何以编程方式访问RadGridView行?

时间:2014-08-17 19:50:56

标签: c# wpf silverlight telerik radgridview

如何访问RadGridView中的行?我想以编程方式设置行不透明度,是否可能?我找不到任何关于它的文件。

<telerik:RadGridView x:Name="radGridStoppedCars" ShowGroupPanel="False" IsFilteringAllowed="False" SelectionChanged="radGridStoppedCars_SelectionChanged"
                         Background="Transparent"
                         ItemsSource="{Binding PerWorkz}" 
                         Width="550"
                         Height="500" 
                         Margin="800, 90,432,-53"
                         RowHeight="45"
                         IsSynchronizedWithCurrentItem="True"
                         RowIndicatorVisibility="Collapsed"
                         CanUserSortColumns="False "  
                         IsReadOnly="True"
                         ShowColumnSortIndexes="False"
                         AutoGenerateColumns="False"
                         CanUserFreezeColumns="False"
                         CanUserResizeColumns="False">
            <telerik:RadGridView.RowStyle>
                <Style TargetType="{x:Type telerik:GridViewRow}">
                    <Setter Property="Foreground" Value="White"/>
                </Style>
            </telerik:RadGridView.RowStyle>

            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Plaka" DataMemberBinding="{Binding PlateNo}" Width="120"/>
                <telerik:GridViewDataColumn Header="Süre" DataMemberBinding="{Binding StoppedDateTime}" Width="*"/>
                <telerik:GridViewDataColumn Header="Durum" DataMemberBinding="{Binding TypeWorkflowStateName}" Width="*"/>
                <telerik:GridViewDataColumn Header="Açıklama" DataMemberBinding="{Binding Note}" Width="*"/>
                <telerik:GridViewDataColumn Header="Süreç" DataMemberBinding="{Binding TimeInfo}" Width="*"/>
                <telerik:GridViewExpressionColumn Header="{Binding PersonnelID}" IsVisible="False"/>
                <telerik:GridViewExpressionColumn Header="{Binding DepartmentID}" IsVisible="False"/>
            </telerik:RadGridView.Columns> 
        </telerik:RadGridView>

1 个答案:

答案 0 :(得分:0)

尝试使用它:

 e.RowElement.DrawFill = true;

void grid_RowFormatting(object sender, Telerik.WinControls.UI.RowFormattingEventArgs e)
{
     if   (e.RowElement.RowInfo.Cells["CODE"].Value.ToString() == "something"))
            {   
                 e.RowElement.DrawFill = true;  
                 e.RowElement.BackColor = System.Drawing.Color.somecolor;
            }

 }

除非应用xaml ...

,否则我没有看到任何其他方式可以进行格式化