Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear all,

I'm google-ing for several days now to find the answer to solve this.

I'm working on an UI, where the user could have to been able to choose the input methos for a "length" value.
Possible scenarios:

direct input:
XML
<textBox x:Name="input1"/>
-> output=input1.text

multiplicator1:
XML
<StackPanel><TextBox x:Name="input2" /><TextBlock Text="*N">
->output=input2.Text*dblN

Ans so on...
My first guess was to create a UserControl hosting a Combobox.
On the Window I place the combo and set the content by codebehind.

XML
<my:CustomCombo x:Name="cb1">

codebehind
VB
Sub New()


    InitializeComponent()

    With Me.cb1.ComboItems
        Dim sp As New StackPanel
        sp.Orientation = Orientation.Horizontal
        sp.Children.Add(New TextBox With {.Text = "0", .FontSize = 8})
        sp.Children.Add(New TextBlock With {.Text = "x N", .FontSize = 8})
        .Add(sp)
        .Add(New TextBox With {.Text = "Text2", .FontSize = 8})

    End With

End Sub


I Set up a DP in the UserControl, so ComboItems holds the ItemsSource
Running this look not so bad, I have my Controls listed and can select them as well.

BUT: I cannot enter them.... (which is normal behavior of a combobox)
Can I achieve my goal on this track or am I completely false?

This is my first WPF-project, so there may be some leaks of understanding though.

Thanks in advance,
D
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900