I have a basic silverlight project that I am doing in an attempt to learn the program. I have a decent amount of experience programming office projects within the MS office suite using VBA, but have not done a lot of standalone programming. My end goal is to create a rectangle that is animated based on the parameters given from a series of controls --
I am starting using a combobox to attempt to change the duration of the animation that I have defined on the rectangle. I am having a problem simply getting the value from the combobox however.
The combobox is defined as:
<ComboBox Height="27" Name="cboDuration" Width="114" >
<ComboBoxItem Content="1" />
<ComboBoxItem Content="2" IsSelected="True" />
<ComboBoxItem Content="3" />
<ComboBoxItem Content="4" />
Currently I am simply trying to get the value that is selected out of the combobox and display it with a message box. I have tried the following:
MessageBox.Show(cboDuration.SelectedValue.ToString()) -- returns System.Windows.Controls.ComboBoxItem
MessageBox.Show(cboDuration.SelectedItem.ToString()) -- returns System.Windows.Controls.ComboBoxItem
MessageBox.Show(cboDuration.SelectedIndex.ToString()) -- returns the correctly selected Index -- not really useful though since I still cannot grab the value
MessageBox.Show(cboDuration.SelectedItem) (or SelectedValue) without the .ToString() results in a conversion error.