Bugs with Quick Access Toolbar

Dec 13, 2010 at 6:56 PM

Hi, I have the latest fluent, and found the following issues with QAT:

1. Add SplitButton to Quick Access Toolbar from the UI by right-clicking on the split button and choose "Add to Quick Access Toolbar" doesn't work. It only adds the split button as a regular button without the dropdown arrow. However, adding the splitbutton using xaml to QAT does work.

2. Can't add comboBox to Quick Access Toolbar using xaml. This is opposite to the issue above. Trying to add a comboBox using the code below doesn't work. It does add the item to the QAT List, but when click on it, it doesn't get added to the QAT bar. However, adding a comboBox at runtime from the UI does work. Very strange.

<Fluent:QuickAccessMenuItem Target="{Binding ElementName=comboBoxFontName}" IsChecked="True" Header ="combo"/>

3. This might be a little hard to reproduce: Persisting the QAT items doesn't work between app session in my application app, but does work in the test app. This is a similar issue to the post on Oct 22. "Quick Access Toolbar in 2.0", 

ParseAndAddToQuickAccessToolBar fails in the following section:

              object[] children = LogicalTreeHelper.GetChildren(current).OfType<object>().ToArray();
                bool indexIsInvalid = children.Length <= indices[i];
                DependencyObject item = indexIsInvalid ? null : children[indices[i]] as DependencyObject;
                if (item == null)
                {
                    // Path is incorrect
                    Debug.WriteLine("Error while QAT items loading: one of the paths is invalid");
                    return;
                }

 

typically because children.Length = 0.

But interestingly when I use my own memoryStream instead of IsolatedStorageFileStream.

 



Dec 13, 2010 at 8:44 PM

Sorry, I didn't finish the previous post. When I use my own memoryStream and call LoadState() directly, it works. Any ideas? Anything wrong with IsolatedStorageFileStream?

  void SaveQATItems()
    {
      using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream())
      {
        RibbonControl.SaveState(memoryStream);
        using (System.Xml.XmlTextWriter xmlTextWriter = new System.Xml.XmlTextWriter(memoryStream, Encoding.UTF8))
        {
          byte[] xmlBytes = memoryStream.ToArray();
          Encoding encoding = new UTF8Encoding();
          Properties.Settings.Default.QATSetting = encoding.GetString(xmlBytes);
          Properties.Settings.Default.Save();
        }
      }
    }

    void LoadQATItems()
    {
      Encoding encoding = new UTF8Encoding();
      byte[] xmlBytes = encoding.GetBytes(Properties.Settings.Default.QATSetting);

      try
      {
        using (System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(xmlBytes))
        {
          RibbonControl.LoadState(memoryStream);
        }
      }
      catch
      {
        
      }
    }
Thanks,
Xiaoling