Silverlight:telerik RadControls中RadGridView的一个Bug及解决办法(转载)
如下图:
滚动条未拖动前

滚动条上下拖动后(注意下图的高亮部分)

重现该Bug的测试代码:
Model层
TextValueObject.cs
namespace RadControlsBug.Model { public class TextValueObject { public string Text { set; get; } public string Value { set; get; } } }SexType.cs
namespace RadControlsBug.Model { public class SexType { /// <summary> /// 男 /// </summary> public static string Male = "男"; /// <summary> /// 女 /// </summary> public static string FeMale = "女"; } }SexTypeCollection.cs
using System.Collections.Generic; namespace RadControlsBug.Model { public static class SexTypeCollection { private static List<TextValueObject> _items = new List<TextValueObject>(); public static List<TextValueObject> Items { get { return _items; } set { _items = value; } } static SexTypeCollection() { _items.Add(new TextValueObject() { Text = "男", Value = SexType.Male }); _items.Add(new TextValueObject() { Text = "女", Value = SexType.FeMale }); } } }Person.cs
using System.Collections.Generic; namespace RadControlsBug.Model { public class Person { public string Name { set; get; } public string Sex { set; get; } private List<TextValueObject> _sexItems = SexTypeCollection.Items; public List<TextValueObject> SexItems { get { return _sexItems; } } } }Company.cs
using System.Collections.ObjectModel; namespace RadControlsBug.Model { public class Company { private ObservableCollection<Person> _employees = new ObservableCollection<Person>(); public ObservableCollection<Person> Employees { get { return _employees; } set { _employees = value; } } public Company() { this._employees.Add(new Person() { Name = "张三", Sex = SexType.Male }); this._employees.Add(new Person() { Name = "李四", Sex = SexType.FeMale }); this._employees.Add(new Person() { Name = "王五", Sex = SexType.Male }); this._employees.Add(new Person() { Name = "赵六", Sex = SexType.FeMale }); this._employees.Add(new Person() { Name = "孙七", Sex = SexType.Male }); this._employees.Add(new Person() { Name = "杨九", Sex = SexType.FeMale }); this._employees.Add(new Person() { Name = "胡十", Sex = SexType.Male }); } } }UI层:
MainPage.Xaml:
<UserControl x:Class="RadControlsBug.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <Grid x:Name="LayoutRoot" Background="White"> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"> <telerik:RadGridView ShowGroupPanel="False" RowIndicatorVisibility="Collapsed" CanUserFreezeColumns="False" AutoGenerateColumns="False" ItemsSource="{Binding Employees,Mode=TwoWay}" Width="300" Height="120" Name="gridView1"> <telerik:RadGridView.Columns> <telerik:GridViewColumn Header="姓名" Width="80" > <telerik:GridViewColumn.CellTemplate> <DataTemplate> <telerik:RadMaskedTextBox Value="{Binding Name,Mode=TwoWay}" MaskType="None"></telerik:RadMaskedTextBox> </DataTemplate> </telerik:GridViewColumn.CellTemplate> </telerik:GridViewColumn> <telerik:GridViewColumn Header="性别" Width="80" > <telerik:GridViewColumn.CellTemplate> <DataTemplate> <telerik:RadComboBox ItemsSource="{Binding SexItems,Mode=TwoWay}" SelectedValue="{Binding Sex,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="Text"/> </DataTemplate> </telerik:GridViewColumn.CellTemplate> </telerik:GridViewColumn> </telerik:RadGridView.Columns> </telerik:RadGridView> </StackPanel> </Grid> </UserControl>MainPage.Xaml.cs:
using System.Windows; using System.Windows.Controls; using RadControlsBug.Model; namespace RadControlsBug { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); this.Loaded += new RoutedEventHandler(Page_Loaded); } void Page_Loaded(object sender, RoutedEventArgs e) { Company _viewModel = new Company(); this.DataContext = _viewModel; } } }该问题曾经困扰我长达2周之久,在Telerik的论坛上提问也未得到回复。
曾经反复尝试,发现解决方法居然极其简单:
<telerik:RadComboBox ItemsSource="{Binding SexItems,Mode=TwoWay}" SelectedValue="{Binding Sex,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="Text"/>
改成:
<telerik:RadComboBox SelectedValue="{Binding Sex,Mode=TwoWay}" SelectedValuePath="Value" DisplayMemberPath="Text" ItemsSource="{Binding SexItems,Mode=TwoWay}"/>
后,问题奇迹般的解决了!
分享于此,希望有助于遇到同样问题的朋友。(个人分析:有可能telerik的开发人员在解析XAML时,判断逻辑依赖于属性出现的顺序导致--胡猜的,我也没去看它的源码)
最后谈一下我个人对于Telerik RadControls For Silverlight这套控件的感受,用这套控件做项目开发已经有近3个月的时间,总体感觉还不错,能大幅提高团队的开发效率,官方有详细文档和示例, 上手非常容易,而且客观来讲,BUG也比较少(用了3个月,基本上才发现这一个比较诡异的BUG),此外,如果是正版用户,官方还提供源码,并有一年的免 费升级期限,每季度官方均会对整套控件做一次升级(主要是修复之前的BUG,以及增加一些新功能)。 从成本上考虑,一套控件的售价9k RMB左右(无Licence数量限制,而且能拿到源码任意修改),国内用户可在慧都控件网上直接购买,对于公司来讲这个成本其实并不高(相比公司招人自 己实现这些控件的功能而言,9k多其实可以忽略不计了),如果您的公司打算致力于企业级应用的RIA开发,建议使用。
Silverlight:telerik RadControls中RadGridView的一个Bug及解决办法(转载)的更多相关文章
- Excel在任务栏中只显示一个窗口的解决办法
Excel在任务栏中只显示一个窗口的解决办法 以前朋友遇到过这个问题,这次自己又遇到了,习惯了以前的那种在任务栏中显示全部窗口,方便用Alt+Tab键进行切换. 如果同时打开许多Excel工作簿, ...
- asp.net开发中遇到的奇葩bug及解决办法(会持续更新。。。)
1,不知道你们遇没遇到过,在vs2010或更高版本上运行程序的时候,完全没问题,放在IIS中出现了问题,就比如左侧是菜单项,点击菜单右边显示,如果菜单链接是这样:content.aspx,而另一个链接 ...
- 记CRenderTarget:DrawText()绘制中文乱码的BUG及解决办法
原文:记CRenderTarget:DrawText()绘制中文乱码的BUG及解决办法 转载请注明出处:http://www.cnblogs.com/Ray1024 一.问题描述 在MFC中使用Dir ...
- 【转载】IE浏览器常见的9个css Bug以及解决办法
IE浏览器常见的9个css Bug以及解决办法 我们在浏览网页的时候经常看见这样的现象:某个网页在IE6浏览器中打开很正常,但是在IE8里面打开可能完全变形了.或者也有可能出现完全相反的现象.这让We ...
- IIS关于“ 配置错误 不能在此路径中使用此配置节”的解决办法
IIS关于“ 配置错误 不能在此路径中使用此配置节”的解决办法 原文链接:http://www.cnblogs.com/200325074/p/3679316.html 今天刚安装好IIS8.5, 我 ...
- 在ASP.net中的UpdatePanel,弹窗失败解决办法
原文:在ASP.net中的UpdatePanel,弹窗失败解决办法 最开始我用: Response.Write("<script>alert('和哈呵呵呵呵呵呵!')</s ...
- 工作总结 EntityFramework中出现DateTime2异常的完美解决办法
EntityFramework中出现DateTime2异常的完美解决办法 今天在使用entityframework往数据库插入数据的时候,突然出现了一个数据类型转换异常的问题: System.Da ...
- Dumpzilla工具第615行bug的解决办法
Dumpzilla工具第615行bug的解决办法 在Dumpzilla使用选项frequency时,会提示SQL语法错误.这是由于其中SQL语句编写错误.需要将615行中: where url l ...
- Ubuntu中Android SDK Manager无法更新解决办法
Ubuntu中Android SDK Manager无法更新解决办法http://hi.baidu.com/petercao2008/item/d7a64441f04668e81e19bc1a
随机推荐
- 转 select()函数以及FD_ZERO、FD_SET、FD_CLR、FD_ISSET
select函数用于在非阻塞中,当一个套接字或一组套接字有信号时通知你,系统提供select函数来实现多路复用输入/输出模型,原型:int select(int maxfd,fd_set *rdset ...
- 【权值分块】bzoj3685 普通van Emde Boas树
权值分块,虽然渐进复杂度不忍直视,但其极小的常数使得实际运行起来比平衡树快,大多数情况和递归版权值线段树差不多,有时甚至更快.但是被zkw线段树完虐. #include<cstdio> # ...
- Java高级架构师(一)第21节:通过X-gen生成商品模块
package com.sishuok.architecture1.goodsmgr.vo; import com.sishuok.architecture1.common.vo.BaseModel; ...
- Sticky Footer,完美的绝对底部
写在前面 做过网页开发的同学想必都遇到过这样尴尬的排版问题:在主体内容不足够多或者未完全加载出来之前,就会导致出现(图一)的这种情况,原因是因为没有足够的垂直空间使得页脚推到浏览器窗口最底部.但是,我 ...
- js之对象(经典)
一.对象的定义: 对象是JavaScript的一个基本数据类型,是一种复合值,它将很多值(原始值或者其他对象)聚合在一起,可通过名字访问这些值.即属性的无序集合. 二.对象的创建(多种方法) 1.对象 ...
- 【spring data jpa】使用jpa的@Query,自己写的语句,报错:org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'status' cannot be found on null
报错: org.springframework.expression.spel.SpelEvaluationException: EL1007E: Property or field 'status' ...
- wpf一些例子
相关知识点:WPF - Adorner WPF Diagram Designer http://www.codeproject.com/Articles/484616/MVVM-Diagram-Des ...
- JS中的Math.pow(a,b)方法
定义和用法 pow() 方法可返回 x 的 y 次幂的值. 语法 Math.pow(x,y) 参数 描述 x 必需.底数.必须是数字. y 必需.幂数.必须是数字. 返回值 x 的 y 次幂. 说明 ...
- HTMLTestRunner美化
https://www.cnblogs.com/findyou/p/6925733.html 参考这个,美化的不错,进入了汉化,及加入了一些样式,
- dot language 学习笔记
dot language 学习笔记 UP | HOME dot language 学习笔记 Table of Contents 1 dot 语言简介 2 基本语法 2.1 常用图形 2.2 常用线 ...