Esempio n. 1
0
        public CRMAppBar()
        {
            //DefaultStyleKeyProperty.OverrideMetadata(typeof(CRMAppBar), new FrameworkPropertyMetadata(typeof(CRMAppBar)));

            if (UIHelper.IsInDesignMode || _instance == null)
            {
                _instance = this;

                _container            = new CRMAppBarContainer();
                _container.Background = _instance.Background;
                Content = _container;

                if (!UIHelper.IsInDesignMode)
                {
                    WeakEventManager <CRMAppBar, PropertyChangedEventArgs> .AddHandler(this, "PropertyChanged", CRMAppBar_PropertyChanged);

                    EventManager.RegisterClassHandler(typeof(CRMAppBar), CRMAppBar.MouseEnterEvent,
                                                      new RoutedEventHandler(OnLocalMouseEnter));

                    EventManager.RegisterClassHandler(typeof(CRMAppBar), CRMAppBar.MouseLeaveEvent,
                                                      new RoutedEventHandler(OnLocalMouseLeave));

                    WeakEventManager <CRMAppBar, TouchEventArgs> .AddHandler(this, "TouchEnter", OnLocalTouchEnter);

                    WeakEventManager <CRMAppBar, TouchEventArgs> .AddHandler(this, "TouchMove", OnLocalTouchMove);

                    WeakEventManager <CRMAppBar, TouchEventArgs> .AddHandler(this, "TouchLeave", OnLocalTouchLeave);
                }
            }

            WeakEventManager <CRMAppBar, RoutedEventArgs> .AddHandler(this, "Loaded", CRMAppBar_Loaded);

            WeakEventManager <CRMAppBar, RoutedEventArgs> .AddHandler(this, "Unloaded", CRMAppBar_Unloaded);
        }
Esempio n. 2
0
        public CRMAppBar()
        {
            //DefaultStyleKeyProperty.OverrideMetadata(typeof(CRMAppBar), new FrameworkPropertyMetadata(typeof(CRMAppBar)));

            if (UIHelper.IsInDesignMode || _instance == null)
            {
                _instance = this;
                
                _container = new CRMAppBarContainer();
                _container.Background = _instance.Background;                
                Content = _container;

                if (!UIHelper.IsInDesignMode)
                {
                    WeakEventManager<CRMAppBar, PropertyChangedEventArgs>.AddHandler(this, "PropertyChanged", CRMAppBar_PropertyChanged);

                    EventManager.RegisterClassHandler(typeof(CRMAppBar), CRMAppBar.MouseEnterEvent,
                                     new RoutedEventHandler(OnLocalMouseEnter));

                    EventManager.RegisterClassHandler(typeof(CRMAppBar), CRMAppBar.MouseLeaveEvent,
                                     new RoutedEventHandler(OnLocalMouseLeave));

                    WeakEventManager<CRMAppBar, TouchEventArgs>.AddHandler(this, "TouchEnter", OnLocalTouchEnter);
                    WeakEventManager<CRMAppBar, TouchEventArgs>.AddHandler(this, "TouchMove", OnLocalTouchMove);
                    WeakEventManager<CRMAppBar, TouchEventArgs>.AddHandler(this, "TouchLeave", OnLocalTouchLeave);
                }
            }

            WeakEventManager<CRMAppBar, RoutedEventArgs>.AddHandler(this, "Loaded", CRMAppBar_Loaded);
            WeakEventManager<CRMAppBar, RoutedEventArgs>.AddHandler(this, "Unloaded", CRMAppBar_Unloaded);
        }