我想綁定一個自定義對象,可以動態地將其更改爲displaed元素。綁定動態對象wpf
我window.xaml有這個現在:
<StackPanel Height="310" HorizontalAlignment="Left" Margin="12,12,0,0" Name="Configuration_stackPanel" VerticalAlignment="Top" Width="264" Grid.Column="1">
<Label Content="{Binding Path=Client}" Height="22" HorizontalAlignment="Left" Margin="20,0,0,0" Name="Client" VerticalAlignment="Top" />
</StackPanel>
在window.xaml.cs,我有件,它
public CustomObject B;
一個CustomObject有一個客戶端成員。 B.Client,得到客戶端名稱(這是一個字符串)
我應該怎麼做才能顯示B.Client,並在代碼發生變化時使其發生變化。
ie:如果在代碼中我做了B.Client =「foo」,那麼foo顯示爲 ,如果我做的是B.Client =「bar」,bar會顯示而不是foo。
在此先感謝
˚F
可以提供CustomObject請的定義是什麼? –