I want to display a ComboBox as TextBox (without border, background, toggle button, ect.) - only current selected item text. I do like this, but I can not understand how to link TextBlock, so that it displays the currently selected item in the ComboBox.
<ComboBox ItemsSource="{Binding Path=...}" SelectedValue="{Binding Path=...}" DisplayMemberPath="Name" SelectedValuePath="Id">
    <ComboBox.Template>
        <ControlTemplate>
            <TextBlock Text="{Binding ?}"></TextBlock>
        </ControlTemplate>
    </ComboBox.Template>
</ComboBox>
<ComboBox ItemsSource="{Binding Path=...}" SelectedValue="{Binding Path=...}" DisplayMemberPath="Name" SelectedValuePath="Id">
<ComboBox.Template>
    <ControlTemplate>
        <TextBlock Text="{Binding SelectedItem.MyText,RelativeSource={RelativeSource Mode=TemplatedParent}}"></TextBlock>
    </ControlTemplate>
</ComboBox.Template>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With