DataGridView + SortableBindingList = 楽
ä¹
ãã¶ãã«C#ãWinFormã®è©±é¡ããã ãã¾C#ãWPFæ代å°æ¥ã§ããWinFormã§ãã
DataGridView ã«ãªãã¸ã§ã¯ããè¼ããã¨ãåã®ããããã¯ãªãã¯ãã¦ã®èªåã½ã¼ããã§ããªãã¦ãã£ãããã¾ãããããã«ã¤ã¼ã³ï¼
VisualStudio2005 ã¯ããã¼ã¿ãã¼ã¹ã®ããã³ãã¨ã³ãã®ãããªã¢ããªãã³ã¼ããæ¸ããã«ä½ãã¦ãã¾ã(ç¡æã® Express ã§ãã£ã¦ã!)ãã¡ããã¡ãã¹ã´ã¤æ©è½ãããã¾ããæ¬æ ¼çãªã¢ããªã®ç¤ã«ããã¡ãã£ã¨ãããã¼ã«ã«ã便å©ã«ä½¿ãã¾ãããªã«ãã® IDE ã®é²åã£ã·ãã¯ï¼
ãã¼ã¿ãã¼ã¹ã ã¨åããããã¯ãªãã¯ããã¨â¼â²ã¿ãããªã®ã表示ããã¦ãåã®å
容ã§ã½ã¼ãã§ãã¾ããã³ã¼ãã£ã³ã°ã¬ã¹ã§ããã¾ã§ã§ãã¾ããã§ãããªãã¸ã§ã¯ã(ã¨ããããåã§ãã)ãå
¥ããã¨ã³ã¼ããæ¸ããªãã¨ã½ã¼ãã§ãã¾ããããã¼ã¿ãã¼ã¹ã¯èªåãªã®ã«ãå·®å¥ã§ãï¼æ°è¡æ¸ãã°ããã ããªãã ãã©ããã¼ã¿ãã¼ã¹ã¯æ¸ããªãã¦ãããã®ã«ã£ã¦æãã¨ãã®ã£ã£ãããé¢åã«æãã¾ã(^^;
ã«ã¹ã¿ã ãã¼ã¿ ãã¤ã³ã (第 2 é¨)
http://www.microsoft.com/japan/msdn/columns/winforms/winforms02182005.aspx
ãã®MSDNã®å¤ãè¨äºã«ãã©ããªåã§ãã½ã¼ãå¯è½ã«ãã SortableBindingList
ãã®è¨äºã®ãµã³ãã«ã§ã¯ããªããè¨äºæ¬æã«æ¸ãã¦ããããã¤ãã®ã¡ã½ããã®å®è£
ãæ¬ ãã¦ã¾ããããã«ãβæ代ã®ã³ã¼ããªã®ã§ãã®ã¾ã¾ã§ã¯ãã«ãã§ãããç´ãã¦ãã«ããã¦ãã·ãªã¢ã©ã¤ãºã®å½¢å¼ãå¤ãã£ãã®ããæ·»ä»ãã¼ã¿ã¯èªããªãã®ã§ã²ã¼ã ã¯éã¹ã¾ããã®ã§ããããããã
æ¬ ãã¦ãé¨åã®å®è£
㯠http://www.thescripts.com/forum/thread441915.html ã® #7 㧠Bart Mermuys ãããæ稿ãã¦ãã¾ããApplySortCore() ãæ¹æªããã¦ãã®ãæ°ã«ãªãã¾ãããMSDNè¨äºã®èã¯ããã«è¼ã£ã¦ããï¼ã¯ã©ã¹ãªã®ã§ãããã ãè¦ãã°å
è¨äºã®ãµã³ãã«ã¯è¦ãªãã¦ãOKã§ãããã ããMSDNè¨äºã®ãµã³ãã«ã³ã¼ãã«ã¤ãã¦ãEULAã¯ç®ãéãã®ãå¿ããã«ã
å®éã«ä½¿ãã«ã¯ PropertyComparer
public SortableBindingList() { } public SortableBindingList( IList<T> list ) : base( list ) { }
使ãæ¹ã¯ç°¡åãä¾ãã° File.cs ã¨ããã¨ã³ãã£ãã£ã¯ã©ã¹ãä½ã£ã¦ DataGridView åã¢ããªãçæããããBindingSource fileBindingSource ã Form ã«ã§ãã¾ããã³ã³ã¹ãã©ã¯ã¿ã Load ããã㧠this.fileBindingSource.DataSource = sortableBindingList; ã¨å
¥ãã¦ããã°OKã§ããã¡ãªã¿ã« BindingSource æããã¤ã¾ããDataGridView - SortableBindingList
- å ã®è¨äºã®ç¬¬ä¸é¨ã¯ãã¡ããå 容ãå¤ãã
- 訳åºããã¦ããªã第ä¸é¨ããã£ããã
å¾ã§èªããã½ã¼ãã¨ãã£ã«ã¿ã®è©±ã
ãã³ã³ãã¥ã¼ã¿ãµã¤ã¨ã³ã¹ã¯ãéæ¥å±¤ãè¨ãããã¨ã§ããããåé¡ã解決ã§ããã¨ãã信念ã«åºã¥ããå¦åã§ããã -- Dennis DeBrulerãKent Beckããã¡ã¦ã©ã¼ã®ããªãã¡ã¯ã¿ãªã³ã°ãã§å¼ç¨ãã¦ããè¨èããã®æ¬ã§ä¸çªå°è±¡ã«æ®ã£ã¦ããé¨åã§ã(ãªãã¡ã¯ã¿ãªã³ã°ã«é¢ä¿ãªããï½)ããã®è¨èãè¡æçã§ãããããããã¨ããã®ã¯å¤§ããã ãã©ãã»ã¼ãã®éãã ããããã¾ã§ããããè¦ç¹ã«æ°ã¥ãã¦ããªãã£ãããæ°ã¥ãã¦ãªãã£ãèªåã«ãé©ããããOSã¯å大ãªéæ¥å±¤ã§ããBindingSource ã SortableBindingList
ã¡ãªã¿ã«ãã®è¨èã®è¨ãã ãã£ãºã¯éãã£ã½ãã£ãããç¶ãããã£ããããããç¶ããè¨ãããã®åç½®ãã£ã½ãè¨èã ã£ãã®ããããã¾ãããWikipediaã®ããã©ã¼ã»ã©ã³ãã½ã³ã®é
ã§ã¯ããããã»ãã¤ã¼ã©ã¼ã®è¨èã¨ããã¦ãã¾ãã
ä»æ¥ã®ã³ã£ããã¯ãçã¾ãå¤ããã¯ããã http://www.kisc.meiji.ac.jp/~metapsi/psi/7-3.htm
ãã¸ã£ããï¼ï¼