0

I searched a lot but i do not know where to start yet. I want to create a Xaml TextBox where inside on any position appears a Combobox if i press mouse button. I want to select a Item from Combobox and the Combo Text selected should be inserted on the position in the TextBox. The ComboBox should not fill the hole TextBox it should only inserting some selectable defined Text pieces. How can I achieve this?

Thomas
  • 11
  • 1
  • I guess you have to write your own control, you can add `TextBox` until `ComboBox`, add rest of string until another `ComboBox`, and you can store these items in a `LinkedList` or any List, and get whole text with a self written property – tetralobita Apr 27 '18 at 13:40

1 Answers1

0

I don´t think you need a TextBox control at all.
If all you want to do is select an item from a list and then display it, that´s exactly what a ComboBox is doing by design.

But if you want to f.e. display the current selection of the ComboBox in another element you can bind the ComboBox.SelectedItem to a TextBox using DataBinding.
You will find a lot of information about binding ´ComboBox´ controls using MVVM in this SO question:
Binding ComboBox SelectedItem using MVVM

If you want to dive in deep in MVVM there is a great article from Josh Smith that I used for getting started with WPF an MVVM:
MVVM Pattern by Josh Smith

Matt F
  • 101
  • 4
  • It should give the user the possiblilty to make a mouse click inside a textbox than the combobox should apeare somewhere on right or left side (like a context menu) where the user can select an item and this item ( string ) will be inserted inside the textbox on the position where the cursor was when the click was done. – Thomas May 04 '18 at 08:23
  • Then this link is probably what you need: https://stackoverflow.com/questions/3373239/wpf-editable-combobox – Matt F May 04 '18 at 08:25