The problem with bindings to CheckBoxTool

Not Answered This post has 0 verified answers | 2 Replies | 2 Followers Thread's RSS feed.

Points 1,775
Replied On: Mon, Mar 5 2012 4:55 AM Reply

Good afternoon.
Using ig: XamRibbon.

<ig:XamRibbon Grid.Row="0" x:Name="MyRibbon"...>
   <ig:XamRibbon.Tabs ...>
     <ig:XamRibbonTabItem ...>
       <ig:XamRibbonGroup Id="ColumnSettingsGroup"..>
         <ig:CheckBoxTool x:Name="EnableMoving" Id="EnableMoving" Caption="".../>

       </ ig: XamRibbonGroup>
     </ ig: XamRibbonTabItem>
   </ ig: XamRibbon.Tabs>
</ ig: XamRibbon>

There is a control with which to associate

<my2:DataGridControl Grid.Row="3" x:Name="NewGrid" Width="500" AllowColumnMoving="{Binding ElementName=EnableMoving, Path=IsChecked}" />

Here the problem, the link does not work.

When using a standard CheckBox it works.

In what may be the problem?

thank you very much

  • Post Points: 20

All Replies

Georgi Angelchov
Points 6,475
Infragistics Employee
Replied On: Mon, Mar 5 2012 10:31 AM Reply


The Ribbon tools are essentially DependencyObjects and they are not FrameworkElements. This is why they cannot participate in DataContext or ElementName bindings.

If you try to access the CheckBoxTool from code behind using it's x:Name attribute, you'll see that you're not even allowed to do that (it will return null). This is a limitation of the platform.

What you're allowed to do is to use bindings to a StaticResource.

So, you have two options in this case:

1. Add event handler to checkbox' Click event and toggle the AllowColumnMoving option of the grid


2. Use a 'proxy' object as a StaticResource and bind Grid's AllowColumnMoving property and CheckBox' IsChecked property to this static resource.

Attached is a sample that demonstrates both approaches.I used a regular button as a target element, changing it's IsEnabled property, but you can use the same approach for your grid.


Hope this helps,

Georgi Angelchov

Software Engineer in Test

NetAdvantage for Silverlight LoB

  • Post Points: 20
Points 1,775
Replied On: Tue, Mar 6 2012 8:11 AM Reply

Thank you very much for your reply. All is clear.

  • Post Points: 5
Page 1 of 1 (3 items) | RSS