Combox tied to Label for enable/disable

Ribbon for WPF Forum

Posted 15 years ago by Nicolas Teeuwen
Version: 9.1.0501
Avatar
I am using the following code to create a combo box with a label above it in the ribbon. The item 1, 2, 3 are really going to be pictures. The reason I want the label above is that there is a "left" and "right" combo box for our application. I cannot figure out a ncie way of setting the label to be disabled whenever the combo box is and vice versa. I cannot use the label feature of the combo box itself as there's no way I know of to make this visible and above the combobox instead of to the left. I am using the command design to facilitate enabling and disabling the combobox. How can I nicely tie the label to the combo box?

    <StackPanel>
        <Label>Lead In</Label>
        <ribbon:ComboBox Height="36" Width="49" Command="SomeCommand">
            <ComboBoxItem>
                Item 1
            </ComboBoxItem>
            <ComboBoxItem>
                Item 2
            </ComboBoxItem>
            <ComboBoxItem>
                Item 3
            </ComboBoxItem>
        </ribbon:ComboBox>
    </StackPanel>

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Nicolas,

Maybe you could bind to the IsEnabled property like this (not tested but may work):
<Label IsEnabled="{Binding ElementName=combo, Path=IsEnabled}">Lead In</Label>
<ribbon:ComboBox x:Name="combo" Height="36" Width="49" Command="SomeCommand">
...


Actipro Software Support

Posted 15 years ago by Nicolas Teeuwen
Avatar
Thank you. This appears to work nicely. I need to examine the binding abilities of WPF more as they seem quite powerful.
The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.