I want to have auto-completion on my multi-line TextBox. Sadly, it seems that WPF does not support this, and the classes from other people I have looked at did not meet my requirements. I found that hosting Windows Forms components is possible in WPF, but I do not understand how to properly "translate" my WPF TextBox:
<TextBox Text="{Binding MyViewModel.MyText}" Style="{StaticResource EventTextBox}" Background="{Binding MyViewModel.MyTextBackgroundColor}">
<ie:Interaction.Triggers>
<ie:EventTrigger EventName="LostFocus">
<mvvml:EventToCommand Command="{Binding MyViewModel.MyTextLostFocusCommand}" PassEventArgsToCommand="True" />
</ie:EventTrigger>
<ie:EventTrigger EventName="GotFocus">
<mvvml:EventToCommand Command="{Binding MyViewModel.MyTextHasFocusCommand}" PassEventArgsToCommand="True"/>
</ie:EventTrigger>
</ie:Interaction.Triggers>
</TextBox>
where we use
xmlns:ie="http://schemas.microsoft.com/expression/2010/interactivity"
and
xmlns:mvvml="http://www.galasoft.ch/mvvmlight"
for signaling.
My Windows Forms Textbox:
<WindowsFormsHost>
<wf:TextBox x:Name="myFormsTextBox"/>
</WindowsFormsHost>
Side questions: How do I translate Style="" and Background="" to Windows Forms, as well as the EventToCommand events?
Main question: How do I do Two-Way data binding for MyViewModel.MyText <=> Windows Forms Textbox?
I looked at https://learn.microsoft.com/en-us/dotnet/framework/wpf/advanced/walkthrough-hosting-a-windows-forms-control-in-wpf-by-using-xaml and https://learn.microsoft.com/en-us/dotnet/framework/wpf/advanced/walkthrough-binding-to-data-in-hybrid-applications but am none the wiser.