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

RadRibbonGroup - visibility bound to data object not working properly.

1 Answer 57 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 23 Nov 2012, 06:34 PM
Hello,

I have discovered a problem when binding the visibiltiy of RadRibbonGroups to a data object.  Please see the sample project below.

You will see that several RadRibbonGroups are bound to the "MyDataObject.IsNew" property and several others are bound to the "CheckBox.IsChecked" property.  Check the box and see what happens.  You'll notice that only some of the groups are displayed...

Ribbon1 will show nothing (the group is bound to "MyDataObject.IsNew").
Ribbon2 will show a group (bound to "CheckBox.IsChecked").
Ribbon3 will show both groups (one bound to "CheckBox.IsChecked" and one to "MyDataObject.IsNew").

After the checkbox is checked, and the groups have not shown up... grab your browser and resize it slightly.  I think an UpdateLayout event occurs and fixes the display of Ribbon1.  My guess is that an updatelayout event occurs on the checkbox bound groups which is why Ribbon2 and Ribbon3 worked initially.

<Grid x:Name="LayoutRoot" Background="White">
  <Grid.RowDefinitions>
    <RowDefinition Height="Auto" />
    <RowDefinition Height="1*" />
    <RowDefinition Height="1*" />
  </Grid.RowDefinitions>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="1*"/>
    <ColumnDefinition Width="1*"/>
  </Grid.ColumnDefinitions>
  <CheckBox x:Name="cb" Grid.ColumnSpan="2" IsChecked="{Binding IsNew, Mode=TwoWay}" Content="Is New" Margin="0,20,0,20" />
  <telerik:RadRibbonView Grid.Row="1" Grid.Column="0">
    <telerik:RadRibbonTab Header="Ribbon1">
      <telerik:RadRibbonGroup Visibility="{Binding IsNew, Converter={StaticResource BoolToVis}, Mode=TwoWay}" Header="IsNew"/>
    </telerik:RadRibbonTab>
  </telerik:RadRibbonView>
  <telerik:RadRibbonView Grid.Row="1" Grid.Column="1">
    <telerik:RadRibbonTab Header="Ribbon2">
      <telerik:RadRibbonGroup Visibility="{Binding IsChecked, ElementName=cb, Converter={StaticResource BoolToVis}, Mode=TwoWay}" Header="IsChecked"/>
    </telerik:RadRibbonTab>
  </telerik:RadRibbonView>
  <telerik:RadRibbonView Grid.Row="2" Grid.ColumnSpan="2">
    <telerik:RadRibbonTab Header="Ribbon3">
      <telerik:RadRibbonGroup Visibility="{Binding IsNew, Converter={StaticResource BoolToVis}, Mode=TwoWay}" Header="IsNew"/>
      <telerik:RadRibbonGroup Visibility="{Binding IsChecked, ElementName=cb, Converter={StaticResource BoolToVis}, Mode=TwoWay}" Header="IsChecked"/>
    </telerik:RadRibbonTab>
  </telerik:RadRibbonView>
</Grid>


using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
 
namespace SilverlightApplication30
{
  public partial class MainPage : UserControl
  {
    MyDataObject mdo = new MyDataObject();
    public MainPage()
    {
      InitializeComponent();
      this.Loaded += MainPage_Loaded;
    }
    void MainPage_Loaded(object sender, RoutedEventArgs e)
    {
      this.DataContext = mdo;
    }
  }
     
  public class MyDataObject : INotifyPropertyChanged
  {
    private bool _IsNew = false;
    public bool IsNew
    {
      get
      {
        return this._IsNew;
      }
      set
      {
        if (this._IsNew == value)
          return;
        this._IsNew = value;
        RaisePropertyChanged("IsNew");
      }
    }
    public event PropertyChangedEventHandler PropertyChanged;
    protected void RaisePropertyChanged(string propertyName)
    {
      PropertyChangedEventHandler propertyChanged = PropertyChanged; 
      if ((propertyChanged != null))
      {
        propertyChanged(this, new PropertyChangedEventArgs(propertyName));
      }
    }
  }
}





1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 28 Nov 2012, 09:44 AM
Hello Rob,

Thank you for your report. This is a known bug and it is already fixed. The fix is available in our latest internal build. Also it would be included in our incoming Service Pack, which will be release until the end of the week.

Please give those version a try and let us know if the bug still presents.

Regards,
Stefan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
RibbonView and RibbonWindow
Asked by
Rob
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or