예제 #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);