示例#1
0
 protected abstract DataTemplate OnSelectTemplate(object item, BindableObject container);
 public void SetParent(object parentElement)
 {
     Target = (MC.BindableObject)parentElement;
 }
示例#3
0
 public static void SetRowSpan(BindableObject bindable, int value)
 {
     bindable.SetValue(RowSpanProperty, value);
 }
示例#4
0
        static void OnTransformChanged(BindableObject bindable, object oldValue, object newValue)
        {
            if ((string)newValue == "none")
            {
                bindable.ClearValue(TranslationXProperty);
                bindable.ClearValue(TranslationYProperty);
                bindable.ClearValue(RotationProperty);
                bindable.ClearValue(RotationXProperty);
                bindable.ClearValue(RotationYProperty);
                bindable.ClearValue(ScaleProperty);
                bindable.ClearValue(ScaleXProperty);
                bindable.ClearValue(ScaleYProperty);
                return;
            }
            var transforms = ((string)newValue).Split(' ');

            foreach (var transform in transforms)
            {
                if (string.IsNullOrEmpty(transform) || transform.IndexOf('(') < 0 || transform.IndexOf(')') < 0)
                {
                    throw new FormatException("Format for transform is 'none | transform(value) [transform(value) ]*'");
                }
                var    transformName = transform.Substring(0, transform.IndexOf('('));
                var    value = transform.Substring(transform.IndexOf('(') + 1, transform.IndexOf(')') - transform.IndexOf('(') - 1);
                double translationX, translationY, scaleX, scaleY, rotateX, rotateY, rotate;
                if (transformName.StartsWith("translateX", StringComparison.OrdinalIgnoreCase) && double.TryParse(value, out translationX))
                {
                    bindable.SetValue(TranslationXProperty, translationX);
                }
                else if (transformName.StartsWith("translateY", StringComparison.OrdinalIgnoreCase) && double.TryParse(value, out translationY))
                {
                    bindable.SetValue(TranslationYProperty, translationY);
                }
                else if (transformName.StartsWith("translate", StringComparison.OrdinalIgnoreCase))
                {
                    var translate = value.Split(',');
                    if (double.TryParse(translate[0], out translationX) && double.TryParse(translate[1], out translationY))
                    {
                        bindable.SetValue(TranslationXProperty, translationX);
                        bindable.SetValue(TranslationYProperty, translationY);
                    }
                }
                else if (transformName.StartsWith("scaleX", StringComparison.OrdinalIgnoreCase) && double.TryParse(value, out scaleX))
                {
                    bindable.SetValue(ScaleXProperty, scaleX);
                }
                else if (transformName.StartsWith("scaleY", StringComparison.OrdinalIgnoreCase) && double.TryParse(value, out scaleY))
                {
                    bindable.SetValue(ScaleYProperty, scaleY);
                }
                else if (transformName.StartsWith("scale", StringComparison.OrdinalIgnoreCase))
                {
                    var scale = value.Split(',');
                    if (double.TryParse(scale[0], out scaleX) && double.TryParse(scale[1], out scaleY))
                    {
                        bindable.SetValue(ScaleXProperty, scaleX);
                        bindable.SetValue(ScaleYProperty, scaleY);
                    }
                }
                else if (transformName.StartsWith("rotateX", StringComparison.OrdinalIgnoreCase) && double.TryParse(value, out rotateX))
                {
                    bindable.SetValue(RotationXProperty, rotateX);
                }
                else if (transformName.StartsWith("rotateY", StringComparison.OrdinalIgnoreCase) && double.TryParse(value, out rotateY))
                {
                    bindable.SetValue(RotationYProperty, rotateY);
                }
                else if (transformName.StartsWith("rotate", StringComparison.OrdinalIgnoreCase) && double.TryParse(value, out rotate))
                {
                    bindable.SetValue(RotationProperty, rotate);
                }
                else
                {
                    throw new FormatException("Invalid transform name");
                }
            }
        }
示例#5
0
 public static int GetRowSpan(BindableObject bindable)
 {
     return((int)bindable.GetValue(RowSpanProperty));
 }
示例#6
0
 public static void SetColumn(BindableObject bindable, int value)
 {
     bindable.SetValue(ColumnProperty, value);
 }
示例#7
0
 public static int GetColumn(BindableObject bindable)
 {
     return((int)bindable.GetValue(ColumnProperty));
 }
示例#8
0
 internal static void SetHeadlessOffset(BindableObject bindable, Point value)
 => bindable.SetValue(HeadlessOffsetPropertyKey, value);
示例#9
0
 public static Point GetHeadlessOffset(BindableObject bindable)
 => (Point)bindable.GetValue(HeadlessOffsetProperty);
示例#10
0
 public static void SetIsHeadless(BindableObject bindable, bool value)
 => bindable.SetValue(IsHeadlessProperty, value);
示例#11
0
 public static bool GetIsHeadless(BindableObject bindable)
 => (bool)bindable.GetValue(IsHeadlessProperty);