Hi @VoyTec ,
Welcome to Microsoft Q&A!
You will get a string of Microsoft.xx.xx
, indicating that you use some specific types, such as FontFamily
in the official document, use SelectedItem.ToString() will get Windows.UI.Xaml.Media.FontFamily
.
Please refer to the following code for the correct and simple way.
Page.xaml
<ComboBox x:Name="TestCombo" Header="Choose" Height="44" Width="296"
ItemsSource="{x:Bind datas}" SelectionChanged="TestCombo_SelectionChanged">
</ComboBox>
Page.xaml.cs
ObservableCollection<string> datas = new ObservableCollection<string>();
public MainPage()
{
this.InitializeComponent();
datas.Add("Hello");
datas.Add("Hello World");
datas.Add("Hello New World");
}
private void TestCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
string strSelected = e.AddedItems[0].ToString();
Debug.WriteLine(strSelected);
}
Thank you
Junjie