【问题标题】:Add Effect to some of the rows in a DataGrid将效果添加到 DataGrid 中的某些行
【发布时间】:2010-11-10 11:50:18
【问题描述】:

这就是我想要的: 当用户单击按钮时,所有符合条件的行都应添加模糊效果

问题:我发现这样做的唯一方法是在 LoadingRow 事件中。但在我的情况下,当我想应用模糊效果时,该行已经加载。

问题:如何迭代行以便应用模糊效果。或者,更好的是,如何将 Effect 绑定到行?

这是我的代码,只有在启动时应用效果时才有效:

    private void dg_LoadingRow(object sender, DataGridRowEventArgs e)
    {
        if (true) // Logic for figuring out if a row should be blur'ed
            e.Row.Effect = new BlurEffect { Radius = 8 };
    }

感谢您的帮助

拉西

【问题讨论】:

    标签: silverlight datagrid effects


    【解决方案1】:

    我找到了解决办法:

    像这样绑定到 DataGridCellPresenter 上的 Effect 属性:

    <sdk:DataGridCellsPresenter x:Name="CellsPresenter" Grid.Column="1" sdk:DataGridFrozenGrid.IsFrozen="True" Effect="{Binding ., Converter={StaticResource BlurConverter}}"/>
    

    转换器很简单:

    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        // Some logic...
        return new BlurEffect { Radius = 8 }; 
    }
    

    拉尔斯·埃里克

    【讨论】:

      猜你喜欢
      • 2020-08-06
      • 1970-01-01
      • 2016-03-14
      • 1970-01-01
      • 1970-01-01
      • 2015-06-18
      • 1970-01-01
      • 2018-06-25
      • 2013-04-09
      相关资源
      最近更新 更多