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
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型