2016-07-27 12 views
1

DataGridの標準DataGridRowをカスタムバージョンのMyDataGridRowに置き換えることができます。標準のDataGridRowをWPF DataGridのカスタムDataGridRowに置き換える方法

public class MyDataGridRow : DataGridRow 
{ ... } 

は私がDataGridRow標準のTemplate置き換えることができます知っているが、それは新しいプロパティ、イベントなど

それは可能なはずの導入のようなオプションの多くを開くと、私は、それを完全に交換したいです、おもう。

あなたの考え!

質問は可能な重複:How can I add Dependency Property to a DataGridRow WPFと比較してより明確です。私の質問のタイトルと質問の内容は、より有用でより一般的です。この質問を投稿する前に、私はたくさんの検索をしましたが、何も見つかりませんでした。

+1

可能な重複から適応回答[どのように私はDataGridRow WPFへの依存プロパティを追加することができます](http://stackoverflow.com/questions/24104080/how-can-i-add-依存関係プロパティ対データグリッドwpf) – ASh

答えて

2

新しいDataGridを作成し、そのGetContainerForItemOverride()メソッドをオーバーライドして新しいDataGridRowExを返します。

public class DataGridRowEx : DataGridRow 
    { 
     // you can add any custom dependency property here 
    } 

    public class DataGridEx : DataGrid 
    { 
     //... 
     protected override DependencyObject GetContainerForItemOverride() 
     { 
      return new DataGridRowEx(); 
     } 
    } 

How can I add Dependency Property to a DataGridRow WPF

関連する問題