i´ve got a combobox and im trying to set either the x:Name or the content of the selected comboItem (Both is okay, i´ll take the easier one) to an list. But i allways just geht things like this: System.Window.Controls.StackPanel or System.Window.Controls.Comboboxitem..
i tried to do it in many ways, so here s what i have right now:
sc.BC = ((ComboBoxItem)comboBox.SelectedItem).Content.ToString();
and in Xaml the list looks like this:
<ComboBox x:Name="comboBox" SelectedValuePath="Content" IsEnabled="True" HorizontalAlignment="Left" Height="23" Margin="241,21,0,0" VerticalAlignment="Top" Width="120">
<ComboBoxItem IsSelected="True" x:Name="wertwret">
<StackPanel Orientation="Horizontal">
<TextBlock Background="White" >---</TextBlock>
<TextBlock Text=" item1"/>
</StackPanel>
</ComboBoxItem>
can anybody help me ? thanks
If the name of ComboBoxItem
is what you need, then just:
sc.BC = ((ComboBoxItem)comboBox.SelectedItem).Name;
"--- item1" is compound content of two UI elements.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.