Example #1
0
        static PlanePanel()
        {
            Type type = typeof(PlanePanel);

            DefaultStyleKeyProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(type));

            // Specify new default values.
            MaximaXProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(new Interval <double, double>(double.MinValue, double.MaxValue)));
            MaximaYProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(new Interval <double, double>(double.MinValue, double.MaxValue)));
            VisibleIntervalXProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(new Interval <double, double>(0, 100)));
            VisibleIntervalYProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(new Interval <double, double>(0, 100)));
            MinimumSizeXProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(double.MinValue));
            MaximumSizeXProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(double.MaxValue));
            MinimumSizeYProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(double.MinValue));
            MaximumSizeYProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(double.MaxValue));
        }
Example #2
0
        static TimePanel()
        {
            Type type = typeof(TimePanel);

            DefaultStyleKeyProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(type));

            // Specify new default values.
            MaximaXProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(new Interval <DateTime, TimeSpan>(DateTime.MinValue, DateTime.MaxValue)));
            MaximaYProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(new Interval <double, double>(0, 100)));
            DateTime now  = DateTime.Now;
            TimeSpan span = TimeSpan.FromHours(12);

            VisibleIntervalXProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(new Interval <DateTime, TimeSpan>(now - span, now + span)));
            VisibleIntervalYProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(new Interval <double, double>(0, 100)));
            MinimumSizeXProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(TimeSpan.MinValue));
            MaximumSizeXProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(TimeSpan.MaxValue));
            MinimumSizeYProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(double.MinValue));
            MaximumSizeYProperty.OverrideMetadata(type, new FrameworkPropertyMetadata(double.MaxValue));

            // Set conversion functions for datetime intervals.
            Interval <DateTime, TimeSpan> .ConvertDoubleToSize = d => new TimeSpan((long)Math.Round(d));
            Interval <DateTime, TimeSpan> .ConvertSizeToDouble = s => s.Ticks;
        }