示例#1
0
        static void OnDataStringPropertyChanged(BindableObject bindable, object oldValue, object newValue)
        {
            var ctrl = bindable as FlexiblePath;
            var convertedGeometry = new PathGeometry();

            PathFigureCollectionConverter.ParseStringToPathFigureCollection(convertedGeometry.Figures, newValue.ToString());
            ctrl.Data = convertedGeometry;
        }
示例#2
0
        protected override void Init()
        {
            var layout      = new StackLayout();
            var statusLabel = new Label
            {
                AutomationId = StatusLabelId,
                Text         = ResetStatus,
            };

            var lgb = new LinearGradientBrush();

            lgb.GradientStops.Add(new GradientStop(Color.White, 0));
            lgb.GradientStops.Add(new GradientStop(Color.Orange, 1));

            var pathGeometry = new PathGeometry();

            PathFigureCollectionConverter.ParseStringToPathFigureCollection(pathGeometry.Figures, "M0,0 V300 H300 V-300 Z");

            var path = new Path
            {
                AutomationId = PathId,
                Data         = pathGeometry,
                Fill         = lgb
            };

            var touch = new TapGestureRecognizer
            {
                Command = new Command(_ => statusLabel.Text = ClickedStatus),
            };

            path.GestureRecognizers.Add(touch);

            var resetButton = new Button
            {
                Text    = "Reset",
                Command = new Command(_ => statusLabel.Text = ResetStatus),
            };

            layout.Children.Add(path);
            layout.Children.Add(statusLabel);
            layout.Children.Add(resetButton);

            Content = layout;
        }