0

ComboBox でのバインディングの使用に問題があります。

   <ComboBox
            Margin="2"
            x:Name="itemSelector"
            SelectionChanged="itemSelector_SelectionChanged">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Id}"/>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>

私のオブジェクトはpublic class MyButton : MyElement、 Id 属性が MyElement クラスに設定されています。

もちろん Id は public 属性です: public string Id;. MyButton クラスにある属性にアクセスしようとすると機能しますが、「Id」フィールドでは何も得られません...

4

2 に答える 2