ListBox SelectedValue - Problem
Ich habe das Problem das mir zu fiel info mit SelectedValue ausgegeben wird.
Es tut was es soll aber die Ausgabe sieht volgender massen aus:
Ähmm, ich möchte aber doch nur "Arbeit" als String.
Warum passiert dass so und nicht wie ich es will ?
Für Aufklärung wäre ich dankbar.
textausgabe.Text = kategorie_eingang.SelectedValue.ToString();
Es tut was es soll aber die Ausgabe sieht volgender massen aus:
System.Windows.Controls.ListBoxItem: Arbeit
Ähmm, ich möchte aber doch nur "Arbeit" als String.
Warum passiert dass so und nicht wie ich es will ?
Für Aufklärung wäre ich dankbar.
Please also mark the comments that contributed to the solution of the article
Content-Key: 33790147557
Url: https://administrator.de/contentid/33790147557
Printed on: December 3, 2023 at 14:12 o'clock
1 Comment

Du wandelst das ganze Objekt zu einem String statt nur den Inhalt abzufragen
"Content" is your friend ..
RTFM https://learn.microsoft.com/de-de/dotnet/api/system.windows.controls.lis ...
Sid.
"Content" is your friend ..
RTFM https://learn.microsoft.com/de-de/dotnet/api/system.windows.controls.lis ...
textausgabe.Text = kategorie_eingang.SelectedValue.Content;