10/01/26 22:47:28
補足、作法にのっとるなら依存関係プロパティ
public class Hoge : DependencyObject {
public DependencyProperty IDProperty = DependencyProperty.Register("ID", typeof(int), typeof(Hoge));
public DependencyProperty DataProperty = DependencyProperty.Register("Data", typeof(string), typeof(Hoge));
public int ID {
get { return (int)this.GetValue(IDProperty); }
set { this.SetValue(IDProperty, value); }
}
public string Data {
get { return (string)this.GetValue(DataProperty); }
set { this.SetValue(DataProperty, value); }
}}
これでBindingが使えるようになる。
<d:Hoge ID="0" Data="{Binding Source=button1, XPath=Content}"/>