Beispiel #1
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.cb1 = ((WPFlayout.ContentControl.DemoDependencyProperty.CoordinateBox)(target));
                return;

            case 2:
                this.cb2 = ((WPFlayout.ContentControl.DemoDependencyProperty.CoordinateBox)(target));
                return;
            }
            this._contentLoaded = true;
        }
        //属性值变更时,触发用户界面的更新,并更新用户界面
        static void OnValueChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args)
        {
            CoordinateBox box = sender as CoordinateBox;

            //更新文本框的值
            box.UpdateValue();

            //定义路由事件参数
            RoutedPropertyChangedEventArgs <Coordinate> e = new RoutedPropertyChangedEventArgs <Coordinate>((Coordinate)args.OldValue
                                                                                                            , (Coordinate)args.NewValue
                                                                                                            , ValueChangedEvent);

            //触发路由事件
            box.OnValueChanged(e);
        }