摘要: 项目中要求datagrid能支持双击导航。但客户有可能点击到其它地方,比如column header, Border,....怎么来确定用户双击的是datagrid的某一行用下面的方法可以解决 public DataGridRow GetDataGridRow(MouseButtonEventArgs e) { FrameworkElement source = e.OriginalSource as FrameworkElement; return DataGridRow.GetRowContainingElement(source); }上面函数返回空的则表示点击了其它地方,反之也成立 阅读全文
posted @ 2011-06-22 18:28 mjg 阅读(1176) 评论(3) 推荐(1) 编辑
摘要: 今天边学边做了些css的tasks.下面几点今后会用到。.box{overflow:auto; // 1。<div class="box"> <table>.....</table>当table内容过高或过长时自动产生scroll bar}.tbcontent{font-family: Arial, Tahoma, Verdana, Calibri;border:solid #ababab;-moz-border-radius: 5px;border-bottom-width: 2px;border-top-width: 25px;wid 阅读全文
posted @ 2011-06-21 18:42 mjg 阅读(356) 评论(0) 推荐(0) 编辑
摘要: 项目中遇到需要获取一个元素的所有子元素或后代元素, 系统有FindName("Name"),但我们需要的元素大部分都没有name,而且FindName只能返回一个结果。我们扩展了 方法,解决的获取所有子元素或后代元素 public static List<DependencyObject> GetChildern(this DependencyObject root) { if (root == null) return null; int count = VisualTreeHelper.GetChildrenCount(root); if (count &l 阅读全文
posted @ 2011-06-18 16:13 mjg 阅读(793) 评论(2) 推荐(0) 编辑
摘要: 最近解决了一个Silverlight ChildWindow Resize的问题,能支持上下左右,角Resize. 解决办法如下重写APP.Xaml里面重写<Application.Resources> <Style x:Key="ResizableChildWindow" TargetType="controls:ChildWindow">...............</Application.Resources><ChildWindow..... Style="{StaticResource Re 阅读全文
posted @ 2011-06-16 14:38 mjg 阅读(758) 评论(5) 推荐(0) 编辑
摘要: 最近项目中遇到一个问题,保存seller report card的时候使用下面的代码 string html = GetHtml(card, properties, propertyColumns, labels, labelColumns, enforcements, enforcementColumns, listings, listingColumns, products, productColumns, aliases, aliasColumns); Stream s = fsd.OpenFile(); //StreamWriter w = new StreamWriter(s); / 阅读全文
posted @ 2011-06-14 15:32 mjg 阅读(373) 评论(0) 推荐(0) 编辑
摘要: 最近在做一个StockAnlysis软件,需要在yahoo下载近10年的Daily Report. 有3378332多万条数据,开始使用entity framwork, 保存了一晚上才保存了140万条,这太需要时间,后来在网上查了些,使用Bulk Insert保存起来很快,使用如下方式半个小时就把所有数据保存完。Get Data From Yahoo----> Save as Text to local disk ----> Bulk Insert.Bulk Insert的代码如下Bulk insert StockDailyReportfrom 'E:\Users\Admi 阅读全文
posted @ 2011-06-13 14:45 mjg 阅读(422) 评论(1) 推荐(0) 编辑
摘要: 最近项目中需要弹出child window, 自动Focus 在用户输入的TextBox里面。解决办法如下MyChildWindow{。。。。。。。 protected override void OnOpened() { base.OnOpened(); textBoxToGetFocus.Focus(); }。。。。。。。。。} 阅读全文
posted @ 2011-06-11 09:43 mjg 阅读(285) 评论(0) 推荐(0) 编辑
摘要: 最近项目中遇到一个问题需要把一个enum type绑定到combox,而且要有space.开始定义如下 public enum SearchConfigType { SmartFrequency, EveryNDays, Weekly, Monthly, }使用我们库函数AddSpaceBeforeUppercaseChar 有点问题SmartFrequency --> Smart Frequency,EveryNDays--->EveryN Days, 这个库函数在其他地方要用,不能修改。如果改成 public enum SearchConfigType { Smart_Freq 阅读全文
posted @ 2011-06-08 13:44 mjg 阅读(405) 评论(0) 推荐(0) 编辑
摘要: http://www.google.com.hk/ggblog/googlechinablog/2006/04/blog-post_7327.html (数学之美 系列一 -- 统计语言模型)http://www.google.com.hk/ggblog/googlechinablog/2006/04/blog-post_2507.html(数学之美 系列二 -- 谈谈中文分词)http://www.google.com.hk/ggblog/googlechinablog/2006/04/blog-post_1583.html(数学之美 系列三 -- 隐含马尔可夫模型在语言处理中的应用)htt 阅读全文
posted @ 2011-06-08 13:14 mjg 阅读(486) 评论(0) 推荐(0) 编辑
摘要: 1.代码安全 AppliedComputerFullSearch string VIEWSTATE = xdoc.Root.GetDescendant(xns, "input", "id", "__VIEWSTATE").GetAttribute("value") + "&";2.代码高效 3.代码逻辑 listing.Price = priceTag.GetDescendant(xns, "b", "class", "priceLarg 阅读全文
posted @ 2011-04-22 19:07 mjg 阅读(153) 评论(0) 推荐(0) 编辑