xxr505 2015-07-04 08:00 采纳率: 0%
浏览 1620

how did set gridcontrol rowstyle in silverlight?

我想改变gridcontrol默认的行颜色,不成功。部分代码如下:

        <dxg:GridControl x:Name="_gridControl"  AutoPopulateColumns="False"  ColumnsPopulated="_gridControl_ColumnsPopulated"  Height="150" >
            <dxg:GridControl.View>
                <dxg:TableView x:Name="_tableView" AllowSorting="False" ShowGroupPanel="False"  AutoWidth="true" NewItemRowPosition="Bottom"  RowIndicatorContentTemplate="{StaticResource rowIndicatorContentTemplate}">
                    <dxg:TableView.RowStyle>
                        <Style TargetType="dxg:GridRowContent">  
                            <Setter Property="Background" Value="Red" />
                            <Setter Property="Foreground" Value="Red" />
                        </Style>
                    </dxg:TableView.RowStyle>
  • 写回答

2条回答 默认 最新

  • save4me 2015-07-04 09:38
    关注

    参考Silverlight DevExpress之GridControl+TableView实现隔行换色
    先在配置文件和窗口界面设置好,然后在后台代码中添加代码

        #region 隔行换色
        public class SelectionStateToBrushConverter : IValueConverter
        {
            public SolidColorBrush NormalBrush { get; set; }
            public SolidColorBrush AlternateBrush { get; set; }
    
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                bool IsAlterRow = (bool)value;
                if (IsAlterRow)
                    return AlternateBrush;
                return NormalBrush;
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                throw new NotImplementedException();
            }
        }
        #endregion
    
    评论

报告相同问题?