請檢查ListBox中的代碼,我使用怎樣訪問一個單選按鈕一ListBoxItem的內部,Windows Phone 7的
<ListBox Name="listBoxDefaultAcc" HorizontalAlignment="Left" VerticalAlignment="Top" Width="450" Height="410">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Height="60" Width="450">
<RadioButton Content="{Binding}" GroupName="defaultAcc" HorizontalAlignment="Left" VerticalAlignment="Center" Height="80" Width="450" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
現在我想從代碼隱藏訪問RadioButton
的content
財產。
的ListBoxItems
都可以從代碼隱藏動態充滿了下面的代碼:
listBoxDefaultAcc.ItemsSource = from acc in db.Table<Accounts>()
select acc.accName;
請幫我出這一點。
當你想訪問該和哪個`RadioButton`?一個側面說明,我不認爲'ListBoxItem` s爲選擇與ItemTemplate中 – 2011-02-11 08:26:22
我想借此選擇`RadioButton`的內容,並將其存儲在獨立存儲,如果這個'ItemTemplate`不會再幫你能否建議我以正確的方式來做到這一點。下面是使用上面的代碼生成的GUI屏幕截圖。 [鏈接](http://img824.imageshack.us/i/capturejcf.png) – Piyush 2011-02-11 08:37:44