1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- namespace PDF_Office.CustomControl
- {
- /// <summary>
- /// 带Path图案的Menuitem 图案颜色跟随文字颜色变化
- /// </summary>
- public class MenuItemWithPath:MenuItem
- {
- static MenuItemWithPath()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(MenuItemWithPath), new FrameworkPropertyMetadata(typeof(MenuItemWithPath)));
- }
- public override void OnApplyTemplate()
- {
- base.OnApplyTemplate();
- }
- public Geometry Path
- {
- get { return (Geometry)GetValue(PathProperty); }
- set { SetValue(PathProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Path. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty PathProperty =
- DependencyProperty.Register("Path", typeof(Geometry), typeof(MenuItemWithPath), null);
- public double PathWidth
- {
- get { return (double)GetValue(PathWidthProperty); }
- set { SetValue(PathWidthProperty, value); }
- }
- // Using a DependencyProperty as the backing store for PathWidth. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty PathWidthProperty =
- DependencyProperty.Register("PathWidth", typeof(double), typeof(MenuItemWithPath), new PropertyMetadata(16.0));
- public double PathHeight
- {
- get { return (double)GetValue(PathHeightProperty); }
- set { SetValue(PathHeightProperty, value); }
- }
- // Using a DependencyProperty as the backing store for PathHeight. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty PathHeightProperty =
- DependencyProperty.Register("PathHeight", typeof(double), typeof(MenuItemWithPath), new PropertyMetadata(16.0));
- }
- }
|