• Dependency property changed example


    public double ScaleFactor
    {
        get { return (double)GetValue(ScaleFactorProperty); }
        set { SetValue(ScaleFactorProperty, value); }
    }
    
    // Using a DependencyProperty as the backing store for ScaleFactor.  This enables animation, styling, binding, etc...
    public static readonly DependencyProperty ScaleFactorProperty =
        DependencyProperty.Register("ScaleFactor", typeof(double), typeof(ToolBlockControl), 
    new UIPropertyMetadata(1.0,new PropertyChangedCallback(ScaleFactorChangedCallBack))); private static void ScaleFactorChangedCallBack(DependencyObject obj, DependencyPropertyChangedEventArgs args) { var toolBlockControl = obj as ToolBlockControl; double scaleFactor = (double)args.NewValue; toolBlockControl.Width = toolBlockControl.mActualWidth * scaleFactor; toolBlockControl.Height = toolBlockControl.mActualHeight * scaleFactor; }
  • 相关阅读:
    二:数组去重
    一:JS 数组对象根据相同key合并成新的数组对象(将一维数组转为多维数组)
    滑动scroll没有效果
    品字布局占满全屏
    js计算器
    html样式初始化
    js计算器
    js邮箱验证
    js菱形
    js实现金字塔图形
  • 原文地址:https://www.cnblogs.com/mrfangzheng/p/1258294.html
Copyright © 2020-2023  润新知