diff --git a/Changelog.md b/Changelog.md index b7ec60706..4438b45f1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,20 @@ # Changelog for Fluent.Ribbon +## 3.6.0 + +- ### Bug fixes + - [#163](../../issues/163) - ColorGallery produces Binding errors because of Binding of Color on SolidColorBrush in Fill/Background + - [#166](../../issues/166) - Type is mismatch for IsCheckedProperty of ToggleButton + - [#170](../../issues/170) - Black RibbonWindow title bar + - [#173](../../issues/173) - Binding Observable Collection to InRibbonGallery causes Layout Error + - [#178](../../issues/178) - Ribbonwindow crashes + +- ### Enhancements + - [#172](../../issues/172) - ToggleButtonHelper.OnIsCheckedChanged() accepts type of "bool?". contributed by ([nishy2000](https://github.com/nishy2000)) + - [#175](../../issues/175) - Add "CloseOnEsc" property to Backstage to disable closing the backstage when ESC is pressed. contributed by Christoph Fink ([chrfin](https://github.com/chrfin)) + +Commits: [c7151027f5...97001b17e9](../../compare/c7151027f5...97001b17e9) + ## 3.5.1 - ### Bug fixes diff --git a/Fluent/Controls/GalleryGroupContainer.cs b/Fluent/Controls/GalleryGroupContainer.cs index 256d6ac57..67a5ed4cc 100644 --- a/Fluent/Controls/GalleryGroupContainer.cs +++ b/Fluent/Controls/GalleryGroupContainer.cs @@ -14,8 +14,11 @@ public class GalleryGroupContainer : HeaderedItemsControl { #region Fields + private Panel previousItemsPanel; + private int previousItemsCount; + // Whether MaxWidth of the ItemsPanel needs to be updated - bool maxMinWidthNeedsToBeUpdated; + private bool maxMinWidthNeedsToBeUpdated; #endregion @@ -154,7 +157,6 @@ public int MaxItemsInRow DependencyProperty.Register("MaxItemsInRow", typeof(int), typeof(GalleryGroupContainer), new UIPropertyMetadata(int.MaxValue, OnMaxMinItemsInRowChanged)); - #endregion #endregion @@ -175,7 +177,7 @@ static object OnCoerceStyle(DependencyObject d, object basevalue) { if (basevalue == null) { - basevalue = (d as FrameworkElement).TryFindResource(typeof(GalleryGroupContainer)); + basevalue = ((FrameworkElement)d).TryFindResource(typeof(GalleryGroupContainer)); } return basevalue; @@ -228,32 +230,52 @@ private void UpdateMinAndMaxWidth() /// public Size GetItemSize() { - if (!double.IsNaN(this.ItemWidth) && !double.IsNaN(this.ItemHeight)) return new Size(this.ItemWidth, this.ItemHeight); - if (this.Items.Count == 0) return Size.Empty; + if (!double.IsNaN(this.ItemWidth) + && !double.IsNaN(this.ItemHeight)) + { + return new Size(this.ItemWidth, this.ItemHeight); + } + + if (this.Items.Count == 0) + { + return Size.Empty; + } + + var anItem = this.ItemContainerGenerator.ContainerFromItem(this.Items[0]) as UIElement; + if (anItem == null) + { + return Size.Empty; + } - UIElement anItem = this.ItemContainerGenerator.ContainerFromItem(this.Items[0]) as UIElement; - if (anItem == null) return Size.Empty; anItem.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); - Size result = anItem.DesiredSize; + var result = anItem.DesiredSize; anItem.InvalidateMeasure(); return result; } // Determinates item's width (return Double.NaN in case of it is not possible) - double GetItemWidth() + private double GetItemWidth() { return this.GetItemSize().Width; } // Finds panel with IsItemsHost, or null if such panel is not found - static Panel FindItemsPanel(DependencyObject obj) + private static Panel FindItemsPanel(DependencyObject obj) { - for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) + for (var i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++) { - Panel panel = obj as Panel; - if (panel != null && panel.IsItemsHost) return panel; + var panel = obj as Panel; + if (panel != null && + panel.IsItemsHost) + { + return panel; + } + panel = FindItemsPanel(VisualTreeHelper.GetChild(obj, i)); - if (panel != null) return panel; + if (panel != null) + { + return panel; + } } return null; @@ -261,9 +283,6 @@ static Panel FindItemsPanel(DependencyObject obj) #endregion - Panel previousItemsPanel = null; - int previousItemsCount = 0; - /// /// Called to remeasure a control. /// @@ -272,9 +291,9 @@ static Panel FindItemsPanel(DependencyObject obj) protected override Size MeasureOverride(Size constraint) { var panel = FindItemsPanel(this); - if (panel != this.previousItemsPanel || - this.previousItemsCount != this.Items.Count || - this.maxMinWidthNeedsToBeUpdated) + if (panel != this.previousItemsPanel + || this.previousItemsCount != this.Items.Count + || this.maxMinWidthNeedsToBeUpdated) { // Track ItemsPanel changing this.previousItemsPanel = panel; @@ -284,4 +303,4 @@ protected override Size MeasureOverride(Size constraint) return base.MeasureOverride(constraint); } } -} +} \ No newline at end of file diff --git a/Fluent/Controls/GalleryItem.cs b/Fluent/Controls/GalleryItem.cs index 418de3787..29c23124b 100644 --- a/Fluent/Controls/GalleryItem.cs +++ b/Fluent/Controls/GalleryItem.cs @@ -24,11 +24,6 @@ namespace Fluent /// public class GalleryItem : ListBoxItem, IKeyTipedControl { - #region Fields - - - #endregion - #region Properties #region KeyTip @@ -296,6 +291,7 @@ public event RoutedEventHandler Click this.RemoveHandler(ClickEvent, value); } } + /// /// Identifies the RibbonControl.Click routed event. /// diff --git a/Fluent/Controls/GalleryPanel.cs b/Fluent/Controls/GalleryPanel.cs index 6e2ca5ff2..e34ca5453 100644 --- a/Fluent/Controls/GalleryPanel.cs +++ b/Fluent/Controls/GalleryPanel.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Windows; using System.Windows.Controls; + using System.Windows.Controls.Primitives; using System.Windows.Data; using System.Windows.Media; using System.Windows.Threading; @@ -607,5 +608,16 @@ protected override IEnumerator LogicalChildren } } } + + /// + /// Called when the collection that is associated with the for this changes. + /// + /// The that raised the event.Provides data for the event. + protected override void OnItemsChanged(object sender, ItemsChangedEventArgs args) + { + base.OnItemsChanged(sender, args); + + this.Dispatcher.BeginInvoke(DispatcherPriority.Background, (Action)(this.Refresh)); + } } } \ No newline at end of file diff --git a/Fluent/Controls/Ribbon.cs b/Fluent/Controls/Ribbon.cs index cece896c2..65f17fd28 100644 --- a/Fluent/Controls/Ribbon.cs +++ b/Fluent/Controls/Ribbon.cs @@ -1984,19 +1984,13 @@ private string IsolatedStorageFileName public void SaveStateToMemoryStream() { - Trace.WriteLine(string.Format("Saving state to memory stream...")); - this.memoryStream.Position = 0; this.SaveState(this.memoryStream); - - Trace.WriteLine(string.Format("State saved to memory stream.")); } // Saves to Isolated Storage (in user store for domain) public void SaveStateToIsolatedStorage() { - Trace.WriteLine(string.Format("Saving state to isolated storage...")); - // Check whether automatic save is valid now if (this.ribbon.AutomaticStateManagement == false) { @@ -2018,8 +2012,6 @@ public void SaveStateToIsolatedStorage() { this.SaveState(stream); } - - Trace.WriteLine(string.Format("State saved to isolated storage.")); } catch (Exception ex) { @@ -2084,12 +2076,8 @@ private void SaveState(Stream stream) public void LoadStateFromMemoryStream() { - Trace.WriteLine(string.Format("Loading state from memory stream...")); - this.memoryStream.Position = 0; this.LoadState(this.memoryStream); - - Trace.WriteLine(string.Format("State loaded from memory stream.")); } /// @@ -2100,8 +2088,6 @@ public void LoadStateFromMemoryStream() /// public void LoadStateFromIsolatedStorage() { - Trace.WriteLine(string.Format("Loading state from isolated storage...")); - // Don't save or load state in design mode if (DesignerProperties.GetIsInDesignMode(this.ribbon)) { @@ -2132,8 +2118,6 @@ public void LoadStateFromIsolatedStorage() this.memoryStream.Position = 0; stream.CopyTo(this.memoryStream); } - - Trace.WriteLine(string.Format("State loaded from isolated storage.")); } } catch (Exception ex) diff --git a/Fluent/Controls/RibbonWindow.cs b/Fluent/Controls/RibbonWindow.cs index b89b14ce2..b26b17779 100644 --- a/Fluent/Controls/RibbonWindow.cs +++ b/Fluent/Controls/RibbonWindow.cs @@ -357,8 +357,6 @@ public override void OnApplyTemplate() this.UpdateCanUseDwm(); - this.UpdateWindowChrome(); - if (this.iconImage != null) { this.iconImage.MouseDown -= this.HandleIconMouseDown; diff --git a/FluentTest/TestContent.xaml b/FluentTest/TestContent.xaml index 9e93522e7..d9ba24fe6 100644 --- a/FluentTest/TestContent.xaml +++ b/FluentTest/TestContent.xaml @@ -1212,9 +1212,10 @@ Header="Pink" /> - + LargeIcon="Images\GreenLarge.png" + Command="{Binding GalleryViewModel.RefreshCommand}" /> - { - new GalleryItemViewModel("Group 1", "1"), - new GalleryItemViewModel("Group 1", "2"), - new GalleryItemViewModel("Group 1", "3"), - new GalleryItemViewModel("Group 1", "4"), - new GalleryItemViewModel("Group 1", "5"), - new GalleryItemViewModel("Group 1", "6"), + this.Items = new ObservableCollection(); + this.RefreshCommand = new RelayCommand(this.Refresh); - new GalleryItemViewModel("Group 2", "10"), - new GalleryItemViewModel("Group 2", "20"), - new GalleryItemViewModel("Group 2", "30"), - new GalleryItemViewModel("Group 2", "40"), - new GalleryItemViewModel("Group 2", "50"), - new GalleryItemViewModel("Group 2", "60"), - }; + this.Refresh(); } public ObservableCollection Items @@ -37,5 +26,25 @@ private set this.OnPropertyChanged("Items"); } } + + public ICommand RefreshCommand { get; private set; } + + public void Refresh() + { + this.Items.Clear(); + + this.Items.Add(new GalleryItemViewModel("Group 1", "1")); + this.Items.Add(new GalleryItemViewModel("Group 1", "2")); + this.Items.Add(new GalleryItemViewModel("Group 1", "3")); + this.Items.Add(new GalleryItemViewModel("Group 1", "4")); + this.Items.Add(new GalleryItemViewModel("Group 1", "5")); + this.Items.Add(new GalleryItemViewModel("Group 1", "6")); + this.Items.Add(new GalleryItemViewModel("Group 2", "10")); + this.Items.Add(new GalleryItemViewModel("Group 2", "20")); + this.Items.Add(new GalleryItemViewModel("Group 2", "30")); + this.Items.Add(new GalleryItemViewModel("Group 2", "40")); + this.Items.Add(new GalleryItemViewModel("Group 2", "50")); + this.Items.Add(new GalleryItemViewModel("Group 2", "60")); + } } } \ No newline at end of file diff --git a/README.md b/README.md index 2d4b29b3c..852a766a3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ Fluent.Ribbon or "Fluent Ribbon Control Suite" ============= + +[![Join the chat at https://gitter.im/fluentribbon/Fluent.Ribbon](https://img.shields.io/badge/GITTER-join%20chat-green.svg?style=flat-square)](https://gitter.im/fluentribbon/Fluent.Ribbon?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Twitter](https://img.shields.io/badge/twitter-%40batzendev-blue.svg?style=flat-square)](https://twitter.com/batzendev) + [![Build status](https://img.shields.io/appveyor/ci/batzen/fluent-ribbon.svg?style=flat-square)](https://ci.appveyor.com/project/batzen/fluent-ribbon) [![Release](https://img.shields.io/github/release/fluentribbon/fluent.ribbon.svg?style=flat-square)](https://github.com/fluentribbon/Fluent.Ribbon/releases/latest) [![Issues](https://img.shields.io/github/issues/fluentribbon/fluent.ribbon.svg?style=flat-square)](https://github.com/fluentribbon/Fluent.Ribbon/issues) diff --git a/Shared/GlobalAssemblyInfo.cs b/Shared/GlobalAssemblyInfo.cs index ad2fa2845..10e63aaf5 100644 --- a/Shared/GlobalAssemblyInfo.cs +++ b/Shared/GlobalAssemblyInfo.cs @@ -23,8 +23,8 @@ [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] -[assembly: AssemblyVersion("3.5.1.0")] -[assembly: AssemblyFileVersion("3.5.1.0")] +[assembly: AssemblyVersion("3.6.0.0")] +[assembly: AssemblyFileVersion("3.6.0.0")] [assembly: AssemblyInformationalVersion("SRC")] [assembly: ComVisible(false)] diff --git a/appveyor.yml b/appveyor.yml index 7c87ccb1d..3f01e4815 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ # http://www.appveyor.com/docs/appveyor-yml -version: 3.5.1.{build} +version: 3.6.0.{build} configuration: Release # Install scripts. (runs after repo cloning) @@ -25,4 +25,11 @@ assembly_info: artifacts: - path: build/bin name: Fluent.Ribbon.$(appveyor_build_version) - type: zip \ No newline at end of file + type: zip + +notifications: + - provider: Webhook + url: https://webhooks.gitter.im/e/855da764a995f5aa1a24 + on_build_success: true + on_build_failure: true + on_build_status_changed: false \ No newline at end of file