I face a real problem in MCCE
My users are allowed to select multiple values from the control. with a mouse click and hold down the CTRL key, all values are in SelectedItems. Write a entry in the Textbox (AR). This is not selected in the Dropdown and also not in the SelectedItems collection. (As shown in the image).
Users are only allowed to use values from the list.I can not use check boxes.Keyboard entries must be possible.I need the values from textbox to work with. But I can not find any property for that
Thanx
Hello Elena,
Thank you for the example. I can use it in my application.
Thanks for your support
Manfred
Hello Manifred,
I have been looking into your question and I can suggest you go through the visual tree elements while you find some from the type you want. For example you can use the following method in order to explore the visual tree and find the textbox in it:
private T GetChildFromType<T>(DependencyObject parent) where T : DependencyObject { T result = null; for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++) { if (VisualTreeHelper.GetChild(parent, i) is T) { return VisualTreeHelper.GetChild(parent, i) as T; } else { result = GetChildFromType<T>(VisualTreeHelper.GetChild(parent, i)); if (result != null) { break; } } } return result; } }
Please let me know if you need any additional assistance on this matter.
Hi Konstatin,
your suggestion (typing the value delimiter character) works. This helps because I can give it to users. Can you give me a small example of how to read visual tree?Thank you for your advice
Hi Mani_Infineon,
if I understood you correctly - you want your users to be able to add items to SelectedItems only by typing into the text box. This is currently available but the selection change is triggered by typing the value delimiter character. If the user input does not have only one match the first item will be selected.
About the text in the TextBox area of MCCE - the control does not expose this value in any way. However you could explore the visual tree and retrieve the value this way.
Hope this helps,