我有一個組合框定義如下:如何修改Silverlight的組合框的數據顯示
<ComboBox x:Name="cboDept" Grid.Row="0" Margin="8,8,8,8" HorizontalAlignment="Left" VerticalAlignment="Top" Width="120"
ItemsSource="{Binding Source={StaticResource cvsCategories}}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Width="Auto" Height="Auto">
<sdk:Label Content="{Binding CategoryID}" Height="20" />
<sdk:Label Content="{Binding CategoryName}" Height="20" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
它工作正常。但是,一旦我選擇了列表中的項目,我想要將不同的模板應用於顯示給用戶的組合框選定項目(彈出消失後顯示的項目)。在上面的情況下,我希望只有在選擇相應的項目後才能在ComboBox中顯示CategoryName。
任何人都可以讓我知道如何做到這一點?
感謝