18 changed files
BExplorer/BetterExplorer | ||
_MainWindow | ||
MainWindow_Updating.cs | ||
app.manifest | ||
MainWindow.xaml | ||
Fluent.Ribbon-develop/Fluent.Ribbon | ||
Controls | ||
RibbonWindow.cs | ||
Metro/Controls | ||
WindowCommands.cs | ||
Themes | ||
Accents | ||
Amber.xaml | ||
GeneratorParameters.json | ||
Controls | ||
WindowCommands.xaml | ||
RibbonWindow.xaml | ||
Styles.xaml | ||
Fluent.Ribbon.NET 4.6.csproj | ||
Shell | ||
Interop | ||
User32.cs | ||
Extensions.cs | ||
ImageListEx.cs | ||
ShellContextMenu.cs | ||
ShellTreeViewEx.cs | ||
ShellViewEx.cs | ||
.gitignore | ||
MainWindow_Updating.cs
/BExplorer/BetterExplorer/_MainWindow/MainWindow_Updating.cs-1+6/BExplorer/BetterExplorer/_MainWindow/MainWindow_Updating.cs
Add comment 1 using System;
Add comment 2 using System.ComponentModel;
Add comment 3 using System.Linq;
Add comment 4 Plus using System.Runtime.InteropServices;
Add comment 4 5 using System.Threading;
Add comment 5 6 using System.Windows;
Add comment 6 7 using System.Windows.Threading;
Add comment 63 64 private void MainWindow_OnClosed(Object sender, EventArgs e) {
Add comment 64 65
Add comment 65 66 }
Add comment 67 Plus [return: MarshalAs(UnmanagedType.Bool)]
Add comment 68 Plus [DllImport("user32.dll", SetLastError = true)]
Add comment 69 Plus private static extern Boolean PostMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
Add comment 70 Plus private void ButtonBase_OnClick(Object sender, RoutedEventArgs e) {
Add comment 71 Plus var b = PostMessage(this.Handle, 0x0084, IntPtr.Zero, (IntPtr) ((10 << 16) | (10 & 0xFFFF)));
Add comment 66 72
Add comment 67 Minus private void ButtonBase_OnClick(Object sender, RoutedEventArgs e) {
Add comment 68 73 new ToastContentBuilder()
Add comment 69 74 .AddArgument("action", "viewConversation")
Add comment 70 75 .AddArgument("conversationId", 9813)
Add comment 23
Add comment 24 <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
Add comment 25 <application>
Add comment 26 Minus <!-- Windows 10 -->
Add comment 27 Minus <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
Add comment 28 Minus <!-- Windows 8.1 -->
Add comment 29 Minus <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />
Add comment 30 Minus <!-- Windows 8 -->
Add comment 31 Minus <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />
Add comment 32 Minus <!-- Windows 7 -->
Add comment 33 Minus <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
Add comment 26 Plus <!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->
Add comment 27 Plus <!--The ID below indicates application support for Windows Vista -->
Add comment 28 Plus <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
Add comment 29 Plus <!--The ID below indicates application support for Windows 7 -->
Add comment 30 Plus <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
Add comment 31 Plus <!--The ID below indicates application support for Windows 8 -->
Add comment 32 Plus <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
Add comment 33 Plus <!--The ID below indicates application support for Windows 8.1 -->
Add comment 34 Plus <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
Add comment 35 Plus <!--The ID below indicates application support for Windows 10 -->
Add comment 36 Plus <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
Add comment 34 37 </application>
Add comment 35 38 </compatibility>
Add comment 36 39
Add comment 40 Plus <application xmlns="urn:schemas-microsoft-com:asm.v3">
Add comment 41 Plus <windowsSettings>
Add comment 42 Plus <!-- Per Monitor V1 [OS >= Windows 8.1] Values: False, True, Per-monitor, True/PM -->
Add comment 43 Plus <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
Add comment 44 Plus <!-- Per Monitor V1 [OS >= Windows 10 Anniversary Update (1607, 10.0.14393, Redstone 1)] Values: Unaware, System, PerMonitor -->
Add comment 45 Plus <!-- Per Monitor V2 [OS >= Windows 10 Creators Update (1703, 10.0.15063, Redstone 2)] Value: PerMonitorV2 -->
Add comment 46 Plus <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor, System</dpiAwareness>
Add comment 47 Plus <!-- If you want to see Windows crash with a kernel error trap, enable gdiScaling -->
Add comment 48 Plus <!--<gdiScaling xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">true</gdiScaling>-->
Add comment 49 Plus </windowsSettings>
Add comment 50 Plus </application>
Add comment 51 Plus
Add comment 37 52 <!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
Add comment 38 53 <dependency>
Add comment 39 54 <dependentAssembly>
MainWindow.xaml
/BExplorer/BetterExplorer/MainWindow.xaml-3+4/BExplorer/BetterExplorer/MainWindow.xaml
Add comment 554 </Ribbon:Ribbon.QuickAccessItems>
Add comment 555 <Ribbon:Ribbon.Menu>
Add comment 556 <Ribbon:Backstage
Add comment 557 Minus x:Name="backstage"
Add comment 557 Plus x:Name="backstage" Margin="1,0,0,0"
Add comment 558 Ribbon:KeyTip.Keys="F"
Add comment 559 Background="DarkOrange"
Add comment 560 Header="Menu"
Add comment 4152 Grid.Row="4"
Add comment 4153 Grid.ColumnSpan="2"
Add comment 4154 Background="{DynamicResource WhiteBrush}"
Add comment 4155 Minus Margin="1,0,1,0">
Add comment 4155 Plus Margin="0">
Add comment 4156 <Grid.ColumnDefinitions>
Add comment 4157 <ColumnDefinition />
Add comment 4158 <ColumnDefinition x:Name="clPreviewSplitter" Width="2" />
Add comment 4169 Grid.ColumnSpan="3"
Add comment 4170 Width="{Binding ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Grid}}}"
Add comment 4171 Height="{Binding ActualHeight, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type RowDefinition}}}"
Add comment 4172 Minus Margin="0" />
Add comment 4172 Plus Margin="0" Visibility="Collapsed"/>
Add comment 4173 <GridSplitter
Add comment 4174 Grid.Row="1"
Add comment 4175 Grid.ColumnSpan="3"
Add comment 4179 Background="LightBlue" />
Add comment 4180 <Grid
Add comment 4181 x:Name="TreeGrid"
Add comment 4182 Plus Margin="2,0,2,0"
Add comment 4182 4183 Grid.Row="2"
Add comment 4183 4184 Grid.Column="0"
Add comment 4184 4185 Background="{DynamicResource WhiteBrush}">
RibbonWindow.cs
/Fluent.Ribbon-develop/Fluent.Ribbon/Controls/RibbonWindow.cs-105+349/Fluent.Ribbon-develop/Fluent.Ribbon/Controls/RibbonWindow.cs
Displayed content is truncated due to maximum viewable content limit.
Add comment 1 // ReSharper disable once CheckNamespace
Add comment 2 Minus namespace Fluent
Add comment 3 Minus {
Add comment 2 Plus
Add comment 3 Plus using System.Runtime.InteropServices;
Add comment 4 Plus using System.Windows.Automation.Peers;
Add comment 5 Plus using System.Windows.Controls;
Add comment 6 Plus using System.Windows.Interop;
Add comment 7 Plus using ControlzEx.Standard;
Add comment 8 Plus
Add comment 9 Plus namespace Fluent {
Add comment 4 10 using System;
Add comment 5 11 using System.Windows;
Add comment 6 12 using System.Windows.Data;
Add comment 22 28 [TemplatePart(Name = PART_ContentPresenter, Type = typeof(UIElement))]
Add comment 23 29 [TemplatePart(Name = PART_RibbonTitleBar, Type = typeof(RibbonTitleBar))]
Add comment 24 30 [TemplatePart(Name = PART_WindowCommands, Type = typeof(WindowCommands))]
Add comment 25 Minus public class RibbonWindow : Window, IRibbonWindow
Add comment 26 Minus {
Add comment 31 Plus public class RibbonWindow : Window, IRibbonWindow {
Add comment 27 32 // ReSharper disable InconsistentNaming
Add comment 28 33 #pragma warning disable SA1310 // Field names must not contain underscore
Add comment 29 34 private const string PART_Icon = "PART_Icon";
Add comment 32 37 private const string PART_WindowCommands = "PART_WindowCommands";
Add comment 33 38 #pragma warning restore SA1310 // Field names must not contain underscore
Add comment 34 39 // ReSharper restore InconsistentNaming
Add comment 35 Minus
Add comment 36 40 private FrameworkElement iconImage;
Add comment 37 41
Add comment 38 42 #region Properties
Add comment 42 46 /// <summary>
Add comment 43 47 /// Gets ribbon titlebar
Add comment 44 48 /// </summary>
Add comment 45 Minus public RibbonTitleBar TitleBar
Add comment 46 Minus {
Add comment 47 Minus get { return (RibbonTitleBar)this.GetValue(TitleBarProperty); }
Add comment 48 Minus private set { this.SetValue(titleBarPropertyKey, value); }
Add comment 49 Plus public RibbonTitleBar TitleBar {
Add comment 50 Plus get => (RibbonTitleBar)this.GetValue(TitleBarProperty);
Add comment 51 Plus private set => this.SetValue(titleBarPropertyKey, value);
Add comment 49 52 }
Add comment 50 53
Add comment 51 54 private static readonly DependencyPropertyKey titleBarPropertyKey = DependencyProperty.RegisterReadOnly(nameof(TitleBar), typeof(RibbonTitleBar), typeof(RibbonWindow), new PropertyMetadata());
Add comment 60 63 /// <summary>
Add comment 61 64 /// Gets or sets the height which is used to render the window title.
Add comment 62 65 /// </summary>
Add comment 63 Minus public double TitleBarHeight
Add comment 64 Minus {
Add comment 65 Minus get { return (double)this.GetValue(TitleBarHeightProperty); }
Add comment 66 Minus set { this.SetValue(TitleBarHeightProperty, value); }
Add comment 66 Plus public double TitleBarHeight {
Add comment 67 Plus get => (double)this.GetValue(TitleBarHeightProperty);
Add comment 68 Plus set => this.SetValue(TitleBarHeightProperty, value);
Add comment 67 69 }
Add comment 68 70
Add comment 69 71 /// <summary>
Add comment 74 76 /// <summary>
Add comment 75 77 /// Gets or sets the <see cref="Brush"/> which is used to render the window title.
Add comment 76 78 /// </summary>
Add comment 77 Minus public Brush TitleForeground
Add comment 78 Minus {
Add comment 79 Minus get { return (Brush)this.GetValue(TitleForegroundProperty); }
Add comment 80 Minus set { this.SetValue(TitleForegroundProperty, value); }
Add comment 79 Plus public Brush TitleForeground {
Add comment 80 Plus get => (Brush)this.GetValue(TitleForegroundProperty);
Add comment 81 Plus set => this.SetValue(TitleForegroundProperty, value);
Add comment 81 82 }
Add comment 82 83
Add comment 83 84 /// <summary>
Add comment 88 89 /// <summary>
Add comment 89 90 /// Gets or sets the <see cref="Brush"/> which is used to render the window title background.
Add comment 90 91 /// </summary>
Add comment 91 Minus public Brush TitleBackground
Add comment 92 Minus {
Add comment 93 Minus get { return (Brush)this.GetValue(TitleBackgroundProperty); }
Add comment 94 Minus set { this.SetValue(TitleBackgroundProperty, value); }
Add comment 92 Plus public Brush TitleBackground {
Add comment 93 Plus get => (Brush)this.GetValue(TitleBackgroundProperty);
Add comment 94 Plus set => this.SetValue(TitleBackgroundProperty, value);
Add comment 95 }
Add comment 96
Add comment 97 /// <summary>
Add comment 107 /// <summary>
Add comment 108 /// Gets or sets the window commands
Add comment 109 /// </summary>
Add comment 110 Minus public WindowCommands WindowCommands
Add comment 111 Minus {
Add comment 112 Minus get { return (WindowCommands)this.GetValue(WindowCommandsProperty); }
Add comment 113 Minus set { this.SetValue(WindowCommandsProperty, value); }
Add comment 110 Plus public WindowCommands WindowCommands {
Add comment 111 Plus get => (WindowCommands)this.GetValue(WindowCommandsProperty);
Add comment 112 Plus set => this.SetValue(WindowCommandsProperty, value);
Add comment 114 113 }
Add comment 115 114
Add comment 116 115 /// <summary>
Add comment 117 116 /// Gets or sets resize border thickness
Add comment 118 117 /// </summary>
Add comment 119 Minus public Thickness ResizeBorderThickness
Add comment 120 Minus {
Add comment 121 Minus get { return (Thickness)this.GetValue(ResizeBorderThicknessProperty); }
Add comment 122 Minus set { this.SetValue(ResizeBorderThicknessProperty, value); }
Add comment 118 Plus public Thickness ResizeBorderThickness {
Add comment 119 Plus get => (Thickness)this.GetValue(ResizeBorderThicknessProperty);
Add comment 120 Plus set => this.SetValue(ResizeBorderThicknessProperty, value);
Add comment 123 121 }
Add comment 124 122
Add comment 125 123 /// <summary>
Add comment 130 128 /// <summary>
Add comment 131 129 /// Gets or sets glass border thickness
Add comment 132 130 /// </summary>
Add comment 133 Minus public Thickness GlassFrameThickness
Add comment 134 Minus {
Add comment 135 Minus get { return (Thickness)this.GetValue(GlassFrameThicknessProperty); }
Add comment 136 Minus set { this.SetValue(GlassFrameThicknessProperty, value); }
Add comment 131 Plus public Thickness GlassFrameThickness {
Add comment 132 Plus get => (Thickness)this.GetValue(GlassFrameThicknessProperty);
Add comment 133 Plus set => this.SetValue(GlassFrameThicknessProperty, value);
Add comment 137 134 }
Add comment 138 135
Add comment 139 136 /// <summary>
Add comment 146 143 /// <summary>
Add comment 147 144 /// Gets or sets whether icon is visible
Add comment 148 145 /// </summary>
Add comment 149 Minus public bool IsIconVisible
Add comment 150 Minus {
Add comment 151 Minus get { return (bool)this.GetValue(IsIconVisibleProperty); }
Add comment 152 Minus set { this.SetValue(IsIconVisibleProperty, value); }
Add comment 146 Plus public bool IsIconVisible {
Add comment 147 Plus get => (bool)this.GetValue(IsIconVisibleProperty);
Add comment 148 Plus set => this.SetValue(IsIconVisibleProperty, value);
Add comment 153 149 }
Add comment 154 150
Add comment 155 151 /// <summary>
Add comment 162 158 /// <summary>
Add comment 163 159 /// Gets whether window is collapsed
Add comment 164 160 /// </summary>
Add comment 165 Minus public bool IsCollapsed
Add comment 166 Minus {
Add comment 167 Minus get { return (bool)this.GetValue(IsCollapsedProperty); }
Add comment 168 Minus set { this.SetValue(IsCollapsedProperty, value); }
Add comment 161 Plus public bool IsCollapsed {
Add comment 162 Plus get => (bool)this.GetValue(IsCollapsedProperty);
Add comment 163 Plus set => this.SetValue(IsCollapsedProperty, value);
Add comment 169 164 }
Add comment 170 165
Add comment 171 166 /// <summary>
Add comment 177 172 /// <summary>
Add comment 178 173 /// Defines if the Ribbon should automatically set <see cref="IsCollapsed"/> when the width or height of the owner window drop under <see cref="Ribbon.MinimalVisibleWidth"/> or <see cref="Ribbon.MinimalVisibleHeight"/>
Add comment 179 174 /// </summary>
Add comment 180 Minus public bool IsAutomaticCollapseEnabled
Add comment 181 Minus {
Add comment 182 Minus get { return (bool)this.GetValue(IsAutomaticCollapseEnabledProperty); }
Add comment 183 Minus set { this.SetValue(IsAutomaticCollapseEnabledProperty, value); }
Add comment 175 Plus public bool IsAutomaticCollapseEnabled {
Add comment 176 Plus get => (bool)this.GetValue(IsAutomaticCollapseEnabledProperty);
Add comment 177 Plus set => this.SetValue(IsAutomaticCollapseEnabledProperty, value);
Add comment 184 178 }
Add comment 185 179
Add comment 186 180 /// <summary>
Add comment 192 186 /// <summary>
Add comment 193 187 /// Defines if the taskbar should be ignored and hidden while the window is maximized.
Add comment 194 188 /// </summary>
Add comment 195 Minus public bool IgnoreTaskbarOnMaximize
Add comment 196 Minus {
Add comment 197 Minus get { return (bool)this.GetValue(IgnoreTaskbarOnMaximizeProperty); }
Add comment 198 Minus set { this.SetValue(IgnoreTaskbarOnMaximizeProperty, value); }
Add comment 189 Plus public bool IgnoreTaskbarOnMaximize {
Add comment 190 Plus get => (bool)this.GetValue(IgnoreTaskbarOnMaximizeProperty);
Add comment 191 Plus set => this.SetValue(IgnoreTaskbarOnMaximizeProperty, value);
Add comment 199 192 }
Add comment 200 193
Add comment 201 194 /// <summary>
Add comment 210 203 /// <summary>
Add comment 211 204 /// Static constructor
Add comment 212 205 /// </summary>
Add comment 213 Minus static RibbonWindow()
Add comment 214 Minus {
Add comment 206 Plus static RibbonWindow() {
Add comment 215 207 DefaultStyleKeyProperty.OverrideMetadata(typeof(RibbonWindow), new FrameworkPropertyMetadata(typeof(RibbonWindow)));
Add comment 216 208
Add comment 217 209 BorderThicknessProperty.OverrideMetadata(typeof(RibbonWindow), new FrameworkPropertyMetadata(new Thickness(1)));
Add comment 221 213 /// <summary>
Add comment 222 214 /// Default constructor
Add comment 223 215 /// </summary>
Add comment 224 Minus public RibbonWindow()
Add comment 225 Minus {
Add comment 226 Minus this.SizeChanged += this.OnSizeChanged;
Add comment 227 Minus this.Loaded += this.OnLoaded;
Add comment 228 Minus
Add comment 229 Minus // WindowChromeBehavior initialization has to occur in constructor. Otherwise the load event is fired early and performance of the window is degraded.
Add comment 230 Minus this.InitializeWindowChromeBehavior();
Add comment 216 Plus public RibbonWindow() {
Add comment 217 Plus //this.SizeChanged += this.OnSizeChanged;
Add comment 218 Plus //this.Loaded += this.OnLoaded;
Add comment 219 Plus //this.InitializeWindowChromeBehavior();
Add comment 220 Plus //this.GlassFrameThickness = new Thickness(0, 1, 0, 0);
Add comment 231 221 }
Add comment 232 222
Add comment 233 223 #endregion
Add comment 234 224
Add comment 235 Minus #region Overrides
Add comment 236 Minus
Add comment 237 Minus /// <summary>
Add comment 238 Minus /// Initializes the WindowChromeBehavior which is needed to render the custom WindowChrome.
Add comment 239 Minus /// </summary>
Add comment 240 Minus private void InitializeWindowChromeBehavior()
Add comment 241 Minus {
Add comment 225 Plus private void InitializeWindowChromeBehavior() {
Add comment 242 226 var behavior = new WindowChromeBehavior();
Add comment 243 227 BindingOperations.SetBinding(behavior, WindowChromeBehavior.ResizeBorderThicknessProperty, new Binding { Path = new PropertyPath(ResizeBorderThicknessProperty), Source = this });
Add comment 244 228 BindingOperations.SetBinding(behavior, WindowChromeBehavior.GlassFrameThicknessProperty, new Binding { Path = new PropertyPath(GlassFrameThicknessProperty), Source = this });
Add comment 247 231 Interaction.GetBehaviors(this).Add(behavior);
Add comment 248 232 }
Add comment 249 233
Add comment 234 Plus #region Overrides
Add comment 235 Plus
Add comment 236 Plus
Add comment 237 Plus
Add comment 250 238 #endregion
Add comment 251 239
Add comment 252 240 // Size change to collapse ribbon
Add comment 253 Minus private void OnSizeChanged(object sender, SizeChangedEventArgs e)
Add comment 254 Minus {
Add comment 241 Plus private void OnSizeChanged(object sender, SizeChangedEventArgs e) {
Add comment 255 242 this.MaintainIsCollapsed();
Add comment 256 243 }
Add comment 257 244
Add comment 258 Minus private void OnLoaded(object sender, RoutedEventArgs e)
Add comment 259 Minus {
Add comment 260 Minus if (this.SizeToContent == SizeToContent.Manual)
Add comment 261 Minus {
Add comment 245 Plus private void OnLoaded(object sender, RoutedEventArgs e) {
Add comment 246 Plus if (this.SizeToContent == SizeToContent.Manual) {
Add comment 262 247 return;
Add comment 263 248 }
Add comment 264 249
Add comment 265 Minus this.RunInDispatcherAsync(() =>
Add comment 266 Minus {
Add comment 250 Plus this.RunInDispatcherAsync(() => {
Add comment 267 251 // Fix for #454 while also keeping #473
Add comment 268 252 var availableSize = new Size(this.TitleBar.ActualWidth, this.TitleBar.ActualHeight);
Add comment 269 253 this.TitleBar.Measure(availableSize);
Add comment 270 254 this.TitleBar.ForceMeasureAndArrange();
Add comment 271 255 }, DispatcherPriority.ApplicationIdle);
Add comment 272 256 }
Add comment 257 Plus /// <summary>
Add comment 258 Plus /// used to overwrite WndProc
Add comment 259 Plus /// </summary>
Add comment 260 Plus /// <param name="e"></param>
Add comment 261 Plus protected override void OnSourceInitialized(EventArgs e) {
Add comment 262 Plus base.OnSourceInitialized(e);
Add comment 263 Plus var source = PresentationSource.FromVisual(this) as HwndSource;
Add comment 264 Plus source.AddHook(WndProcHooked);
Add comment 265 Plus }
Add comment 266 Plus
Add comment 267 Plus public T FindChild<T>(DependencyObject parent, string childName)
Add comment 268 Plus where T : DependencyObject {
Add comment 269 Plus // Confirm parent and childName are valid.
Add comment 270 Plus if (parent == null) return null;
Add comment 271 Plus T foundChild = null;
Add comment 272 Plus int childrenCount = VisualTreeHelper.GetChildrenCount(parent);
Add comment 273 Plus for (int i = 0; i < childrenCount; i++) {
Add comment 274 Plus var child = VisualTreeHelper.GetChild(parent, i);
Add comment 275 Plus // If the child is not of the request child type child
Add comment 276 Plus T childType = child as T;
Add comment 277 Plus if (childType == null) {
Add comment 278 Plus // recursively drill down the tree
Add comment 279 Plus foundChild = FindChild<T>(child, childName);
Add comment 280 Plus // If the child is found, break so we do not overwrite the found child.
Add comment 281 Plus if (foundChild != null) break;
Add comment 282 Plus } else if (!string.IsNullOrEmpty(childName)) {
Add comment 283 Plus var frameworkElement = child as FrameworkElement;
Add comment 284 Plus // If the child's name is set for search
Add comment 285 Plus if (frameworkElement != null && frameworkElement.Name == childName) {
Add comment 286 Plus // if the child's name is of the request name
Add comment 287 Plus foundChild = FindChild<T>(child, childName);
Add comment 288 Plus break;
Add comment 289 Plus }
Add comment 290 Plus } else {
Add comment 291 Plus // child element found.
Add comment 292 Plus foundChild = (T)child;
Add comment 293 Plus break;
Add comment 294 Plus }
Add comment 295 Plus }
Add comment 296 Plus return foundChild;
Add comment 297 Plus }
Add comment 298 Plus [DllImport("user32.dll")]
Add comment 299 Plus [return: MarshalAs(UnmanagedType.Bool)]
Add comment 300 Plus internal static extern bool GetCursorPos(ref Win32Point pt);
Add comment 301 Plus
Add comment 302 Plus [StructLayout(LayoutKind.Sequential)]
Add comment 303 Plus internal struct Win32Point {
Add comment 304 Plus public Int32 X;
Add comment 305 Plus public Int32 Y;
Add comment 306 Plus };
Add comment 307 Plus public static Point GetMousePosition() {
Add comment 308 Plus var w32Mouse = new Win32Point();
Add comment 309 Plus GetCursorPos(ref w32Mouse);
Add comment 310 Plus
Add comment 311 Plus return new Point(w32Mouse.X, w32Mouse.Y);
Add comment 312 Plus }
Add comment 313 Plus [DllImport("user32.dll", EntryPoint = "GetWindowLongPtr")]
Add comment 314 Plus private static extern IntPtr GetWindowLongPtr(IntPtr hWnd, int nIndex);
Add comment 315 Plus private IntPtr WndProcHooked(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) {
Add comment 316 Plus var cp = this.GetPart<UIElement>(PART_WindowCommands) as ContentPresenter;
Add comment 317 Plus var ct = cp.Content as WindowCommands;
Add comment 318 Plus var max = ct.Template.FindName("PART_Max", ct) as System.Windows.Controls.Button;
Add comment 319 Plus var restore = ct.Template.FindName("PART_Restore", ct) as System.Windows.Controls.Button;
Add comment 320 Plus var mp = GetMousePosition();
Add comment 321 Plus AutomationPeer theBtnRestorePeer = UIElementAutomationPeer.CreatePeerForElement(restore);
Add comment 322 Plus Rect rectRestore = theBtnRestorePeer.GetBoundingRectangle();
Add comment 323 Plus AutomationPeer theBtnMaxPeer = UIElementAutomationPeer.CreatePeerForElement(max);
Add comment 324 Plus Rect rectMax = theBtnMaxPeer.GetBoundingRectangle();
Add comment 325 Plus if (msg == 0x0084) {
Add comment 326 Plus
Add comment 327 Plus
Add comment 328 Plus if (rectRestore.Contains(mp.X, mp.Y) || rectMax.Contains(mp.X, mp.Y)) {
Add comment 329 Plus max.Background = (Brush)Application.Current.Resources["Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.MouseOver.Background"];
Add comment 330 Plus restore.Background = (Brush)Application.Current.Resources["Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.MouseOver.Background"];
Add comment 331 Plus handled = true;
Add comment 332 Plus return (IntPtr)9;
Add comment 333 Plus } else {
Add comment 334 Plus max.Background = (Brush)Application.Current.Resources["Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.Background"];
Add comment 335 Plus restore.Background = (Brush)Application.Current.Resources["Fluent.Ribbon.Brushes.WindowCommands.CaptionButton.Background"];
Add comment 336 Plus }
Add comment 337 Plus }
Add comment 338 Plus
Add comment 339 Plus if (msg == 0x00A1 && wParam == (IntPtr)9) {
Add comment 340 Plus handled = true;
Add comment 341 Plus }
Add comment 342 Plus
Add comment 343 Plus if (msg == 0x0024) {
Add comment 344 Plus WmGetMinMaxInfo(hwnd, lParam, (int)MinWidth, (int)MinHeight);
Add comment 345 Plus handled = true;
Add comment 346 Plus }
Add comment 347 Plus
Add comment 348 Plus if (msg == 0x00A2 && wParam == (IntPtr)9) {
Add comment 349 Plus if (this.WindowState == WindowState.Maximized) {
Add comment 350 Plus SystemCommands.RestoreWindow(this);
Add comment 351 Plus } else {
Add comment 352 Plus SystemCommands.MaximizeWindow(this);
Add comment 353 Plus }
Add comment 354 Plus }
Add comment 355 Plus return IntPtr.Zero;
Add comment 356 Plus }
Add comment 273 357
Add comment 274 Minus private void MaintainIsCollapsed()
Add comment 275 Minus {
Add comment 276 Minus if (this.IsAutomaticCollapseEnabled == false)
Add comment 277 Minus {
Add comment 358 Plus private void MaintainIsCollapsed() {
Add comment 359 Plus if (this.IsAutomaticCollapseEnabled == false) {
Add comment 278 360 return;
Add comment 279 361 }
Add comment 280 362
Add comment 281 363 if (this.ActualWidth < Ribbon.MinimalVisibleWidth
Add comment 282 Minus || this.ActualHeight < Ribbon.MinimalVisibleHeight)
Add comment 283 Minus {
Add comment 364 Plus || this.ActualHeight < Ribbon.MinimalVisibleHeight) {
Add comment 284 365 this.IsCollapsed = true;
Add comment 285 Minus }
Add comment 286 Minus else
Add comment 287 Minus {
Add comment 366 Plus } else {
Add comment 288 367 this.IsCollapsed = false;
Add comment 289 368 }
Add comment 290 369 }
Add comment 291 370
Add comment 292 371 /// <inheritdoc />
Add comment 293 Minus public override void OnApplyTemplate()
Add comment 294 Minus {
Add comment 372 Plus public override void OnApplyTemplate() {
Add comment 295 373 base.OnApplyTemplate();
Add comment 296 374
Add comment 297 375 this.TitleBar = this.GetTemplateChild(PART_RibbonTitleBar) as RibbonTitleBar;
Add comment 298 376
Add comment 299 Minus if (this.iconImage != null)
Add comment 300 Minus {
Add comment 377 Plus if (this.iconImage != null) {
Add comment 301 378 this.iconImage.MouseDown -= this.HandleIconMouseDown;
Add comment 302 379 }
Add comment 303 380
Add comment 304 Minus if (this.WindowCommands == null)
Add comment 305 Minus {
Add comment 381 Plus if (this.WindowCommands == null) {
Add comment 306 382 this.WindowCommands = new WindowCommands();
Add comment 307 383 }
Add comment 308 384
Add comment 309 385 this.iconImage = this.GetPart<FrameworkElement>(PART_Icon);
Add comment 310 386
Add comment 311 Minus if (this.iconImage != null)
Add comment 312 Minus {
Add comment 387 Plus if (this.iconImage != null) {
Add comment 313 388 this.iconImage.MouseDown += this.HandleIconMouseDown;
Add comment 314 389 }
Add comment 315 390
Add comment 318 393 }
Add comment 319 394
Add comment 320 395 /// <inheritdoc />
Add comment 321 Minus protected override void OnStateChanged(EventArgs e)
Add comment 322 Minus {
Add comment 396 Plus protected override void OnStateChanged(EventArgs e) {
Add comment 323 397 base.OnStateChanged(e);
Add comment 324 398
Add comment 325 399 // todo: remove fix if we update to ControlzEx 4.0
Add comment 326 400 if (this.WindowState == WindowState.Maximized
Add comment 327 Minus && this.SizeToContent != SizeToContent.Manual)
Add comment 328 Minus {
Add comment 401 Plus && this.SizeToContent != SizeToContent.Manual) {
Add comment 329 402 this.SizeToContent = SizeToContent.Manual;
Add comment 330 403 }
Add comment 331 404
Add comment 332 405 this.RunInDispatcherAsync(() => this.TitleBar?.ForceMeasureAndArrange(), DispatcherPriority.Background);
Add comment 333 406 }
Add comment 334 407
Add comment 335 Minus private void HandleIconMouseDown(object sender, MouseButtonEventArgs e)
Add comment 336 Minus {
Add comment 337 Minus switch (e.ChangedButton)
Add comment 338 Minus {
Add comment 408 Plus private void HandleIconMouseDown(object sender, MouseButtonEventArgs e) {
Add comment 409 Plus switch (e.ChangedButton) {
Add comment 339 410 case MouseButton.Left:
Add comment 340 Minus if (e.ClickCount == 1)
Add comment 341 Minus {
Add comment 411 Plus if (e.ClickCount == 1) {
Add comment 342 412 e.Handled = true;
Add comment 343 413
Add comment 344 414 WindowSteeringHelper.ShowSystemMenu(this, this.PointToScreen(new Point(0, this.TitleBarHeight)));
Add comment 345 Minus }
Add comment 346 Minus else if (e.ClickCount == 2)
Add comment 347 Minus {
Add comment 415 Plus } else if (e.ClickCount == 2) {
Add comment 348 416 e.Handled = true;
Add comment 349 417
Add comment 350 418 #pragma warning disable 618
Add comment 368 436 /// <typeparam name="T">The interface type inheirted from DependencyObject.</typeparam>
Add comment 369 437 /// <param name="name">The name of the template child.</param>
Add comment 370 438 internal T GetPart<T>(string name)
Add comment 371 Minus where T : DependencyObject
Add comment 439 Plus where T : DependencyObject {
Add comment 440 Plus return this.GetTemplateChild(name) as T;
Add comment 441 Plus }
Add comment 442 Plus
Add comment 443 Plus public const int MONITOR_DEFAULTTONULL = 0x00000000;
Add comment 444 Plus public const int MONITOR_DEFAULTTOPRIMARY = 0x00000001;
Add comment 445 Plus public const int MONITOR_DEFAULTTONEAREST = 0x00000002;
Add comment 446 Plus
Add comment 447 Plus [DllImport("user32.dll", CharSet = CharSet.Auto)]
Add comment 448 Plus public static extern bool GetMonitorInfo(IntPtr hmonitor, [In, Out] MONITORINFOEX info);
Add comment 449 Plus
Add comment 450 Plus [DllImport("user32")]
Add comment 451 Plus internal static extern IntPtr MonitorFromWindow(IntPtr handle, int flags);
Add comment 452 Plus
Add comment 453 Plus public static void WmGetMinMaxInfo(IntPtr hwnd, IntPtr lParam, int minWidth, int minHeight)
Add comment 454 Plus {
Add comment 455 Plus IntPtr monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
Add comment 456 Plus if (monitor != IntPtr.Zero) {
Add comment 457 Plus MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
Add comment 458 Plus MONITORINFOEX monitorInfo = new MONITORINFOEX();
Add comment 459 Plus monitorInfo.cbSize = Marshal.SizeOf(typeof(MONITORINFOEX));
Add comment 460 Plus GetMonitorInfo(monitor, monitorInfo);
Add comment 461 Plus RECT rcWorkArea = monitorInfo.rcWork;
Add comment 462 Plus RECT rcMonitorArea = monitorInfo.rcMonitor;
Add comment 463 Plus mmi.ptMaxPosition.x = Math.Abs(rcWorkArea.left - rcMonitorArea.left);
Add comment 464 Plus mmi.ptMaxPosition.y = Math.Abs(rcWorkArea.top - rcMonitorArea.top);
Add comment 465 Plus if (mmi.ptMaxPosition.y == 0)
Add comment 466 Plus mmi.ptMaxPosition.y = 1;
Add comment 467 Plus mmi.ptMaxSize.x = Math.Abs(rcWorkArea.right - rcWorkArea.left);
Add comment 468 Plus mmi.ptMaxSize.y = Math.Abs(rcWorkArea.bottom - rcWorkArea.top);
Add comment 469 Plus Marshal.StructureToPtr(mmi, lParam, true);
Add comment 470 Plus }
Add comment 471 Plus }
Add comment 472 Plus
Add comment 473 Plus [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 4)]
Add comment 474 Plus public class MONITORINFOEX {
Add comment 475 Plus internal int cbSize = Marshal.SizeOf(typeof(MONITORINFOEX));
Add comment 476 Plus internal RECT rcMonitor = new RECT();
Add comment 477 Plus internal RECT rcWork = new RECT();
Add comment 478 Plus internal int dwFlags = 0;
Add comment 479 Plus [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
Add comment 480 Plus internal char[] szDevice = new char[32];
Add comment 481 Plus }
WindowCommands.cs
/Fluent.Ribbon-develop/Fluent.Ribbon/Metro/Controls/WindowCommands.cs-2+2/Fluent.Ribbon-develop/Fluent.Ribbon/Metro/Controls/WindowCommands.cs
Add comment 210 }
Add comment 211
Add comment 212 this.restoreButton = this.Template.FindName("PART_Restore", this) as System.Windows.Controls.Button;
Add comment 213 Minus if (this.restoreButton != null)
Add comment 214 Minus {
Add comment 213 Plus if (this.restoreButton != null) {
Add comment 214 Plus var rw = this.GetParentWindow() as RibbonWindow;
Add comment 215 this.restoreButton.Click += this.RestoreClick;
Add comment 216 }
Add comment 217
Amber.xaml
/Fluent.Ribbon-develop/Fluent.Ribbon/Themes/Accents/Amber.xaml-1+1/Fluent.Ribbon-develop/Fluent.Ribbon/Themes/Accents/Amber.xaml
Add comment 9 <!-- COLORS -->
Add comment 10
Add comment 11 <!-- Accent colors -->
Add comment 12 Minus <Color x:Key="Fluent.Ribbon.Colors.AccentBaseColor">#FFF0A30A</Color>
Add comment 12 Plus <Color x:Key="Fluent.Ribbon.Colors.AccentBaseColor">#B3474646</Color>
Add comment 13 <!-- 80% -->
Add comment 14 <Color x:Key="Fluent.Ribbon.Colors.AccentColor80">#CCF0A30A</Color>
Add comment 15 <!-- 60% -->
GeneratorParameters.json
/Fluent.Ribbon-develop/Fluent.Ribbon/Themes/Accents/GeneratorParameters.json/Fluent.Ribbon-develop/Fluent.Ribbon/Themes/Accents/GeneratorParameters.json
WindowCommands.xaml
/Fluent.Ribbon-develop/Fluent.Ribbon/Themes/Controls/WindowCommands.xaml/Fluent.Ribbon-develop/Fluent.Ribbon/Themes/Controls/WindowCommands.xaml
RibbonWindow.xaml
/Fluent.Ribbon-develop/Fluent.Ribbon/Themes/RibbonWindow.xaml/Fluent.Ribbon-develop/Fluent.Ribbon/Themes/RibbonWindow.xaml
Styles.xaml
/Fluent.Ribbon-develop/Fluent.Ribbon/Themes/Styles.xaml/Fluent.Ribbon-develop/Fluent.Ribbon/Themes/Styles.xaml
Fluent.Ribbon.NET 4.6.csproj
/Fluent.Ribbon-develop/Fluent.Ribbon/Fluent.Ribbon.NET 4.6.csproj/Fluent.Ribbon-develop/Fluent.Ribbon/Fluent.Ribbon.NET 4.6.csproj