This is a migrated thread and some comments may be shown as answers.

Binding controls w/i RadRibbonDropDownButton.DropDownContent

2 Answers 75 Views
Buttons
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 24 Jan 2012, 02:10 AM
Hi.

I'm having a problem with the following code:
<telerik:RadRibbonDropDownButton.DropDownContent>
    <StackPanel >
        <StackPanel Orientation="Horizontal" x:Name="LayoutRoot">
            <ListBox Name="ListBox" ItemsSource="{Binding Path=Columns, ElementName=TableGrid}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <CheckBox Content="{Binding Header}"
                            IsChecked="{Binding IsVisible, Mode=TwoWay}" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <telerik:RadGridView Name="TableGrid" ItemsSource="{Binding Units}" ShowGroupPanel="False" />
        </StackPanel>
    </StackPanel>
</telerik:RadRibbonDropDownButton.DropDownContent>
This is the "Showing and hiding radgrid columns outside the radgrid" example from the Telerik website, in a dropdowncontent.  When I run this and set the datacontext, "TableGrid" shows data properly but "ListBox" does not show the column headers.  If I take the "LayoutRoot" stackpanel up a level, out of the radribbonbutton and into the radribbongroup driectly, it works fine ("ListBox" contains the "TableGrid" headers.)  Poking around I've read that that the dropdowncontext doesn't share the same visual tree as the parent, but I would think I could bind controls from within the dropdowncontext.  Can you point me in the right direction to resolve this please?

Thanks,
MR

2 Answers, 1 is accepted

Sort by
0
Accepted
Petar Mladenov
Telerik team
answered on 26 Jan 2012, 03:23 PM
Hello Mike,

 The behavior you have come up with is Expected. When a Popup is part of a Template (in this case there is the Popup in the DropDownContent) the child elements of the Popup "do not see" each other. This is limitation framework and you can also examine the same behavior when using the DropDownButton from the Extended WPF 4 Toolbox.
However, I think there is a suitable workaround, you can check it out in the attachment. I used Button and on its Click I open a Popup. This way the Popup is not in a Template and its children "play well" together. Please let us know if this is suitable for you.

Greetings,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Mike
Top achievements
Rank 1
answered on 30 Jan 2012, 01:38 AM
This is very helpful.  Thank you.
Tags
Buttons
Asked by
Mike
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Mike
Top achievements
Rank 1
Share this question
or