示例#1
0
        private void FillSegmentedControl_SegmentTapped(object sender, Forms9Patch.SegmentedControlEventArgs e)
        {
            switch (e.Segment.Text)
            {
            case "TILE":
                _f9pImage.Fill  = Forms9Patch.Fill.Tile;
                _xfImage.Aspect = Xamarin.Forms.Aspect.Fill;
                break;

            case "ASPECTFILL":
                _f9pImage.Fill  = Forms9Patch.Fill.AspectFill;
                _xfImage.Aspect = Xamarin.Forms.Aspect.AspectFill;
                break;

            case "ASPECTFIT":
                _f9pImage.Fill  = Forms9Patch.Fill.AspectFit;
                _xfImage.Aspect = Xamarin.Forms.Aspect.AspectFit;
                break;

            default:
                _f9pImage.Fill  = Forms9Patch.Fill.Fill;
                _xfImage.Aspect = Xamarin.Forms.Aspect.Fill;
                break;
            }
        }
示例#2
0
 private void CapsUnitsSegmentedControl_SegmentTapped(object sender, Forms9Patch.SegmentedControlEventArgs e)
 {
     if (e.Index == 0)
     {
         capsInsetsLeftSlider.Maximum   = 200;
         capsInsetsLeftSlider.Value     = 0;
         capsInsetsRightSlider.Maximum  = 200;
         capsInsetsRightSlider.Value    = 0;
         capsInsetsTopSlider.Maximum    = 200;
         capsInsetsTopSlider.Value      = 0;
         capsInsetsBottomSlider.Maximum = 200;
         capsInsetsBottomSlider.Value   = 0;
     }
     else
     {
         capsInsetsLeftSlider.Maximum   = 100;
         capsInsetsLeftSlider.Value     = 0;
         capsInsetsRightSlider.Maximum  = 100;
         capsInsetsRightSlider.Value    = 0;
         capsInsetsTopSlider.Maximum    = 100;
         capsInsetsTopSlider.Value      = 0;
         capsInsetsBottomSlider.Maximum = 100;
         capsInsetsBottomSlider.Value   = 0;
     }
 }
示例#3
0
        void SetShape(object sender = null, Forms9Patch.SegmentedControlEventArgs args = null)
        {
            var text  = shapesSelector.SelectedSegments.First().Text;
            var shape = Forms9Patch.ElementShape.Rectangle;

            if (text == Square)
            {
                shape = Forms9Patch.ElementShape.Square;
            }
            else if (text == Circle)
            {
                shape = Forms9Patch.ElementShape.Circle;
            }
            else if (text == Ellipse)
            {
                shape = Forms9Patch.ElementShape.Elliptical;
            }
            else if (text == "OBROUND")
            {
                shape = Forms9Patch.ElementShape.Obround;
            }
            ((Forms9Patch.ILayout)Content).ElementShape = shape;

            /*
             * absoluteLayout.ElementShape = shape;
             * frame.ElementShape = shape;
             * grid.ElementShape = shape;
             * relativeLayout.ElementShape = shape;
             * stackLayout.ElementShape = shape;
             */
        }
示例#4
0
        private void ShapeAttributesSelector_SegmentTapped(object sender, Forms9Patch.SegmentedControlEventArgs e)
        {
            switch (e.Segment.Text)
            {
            case "BACKGROUND":
                f9pImage.BackgroundColor     = e.Segment.IsSelected ? Color.Orange : Color.Default;
                xamarinImage.BackgroundColor = e.Segment.IsSelected ? Color.Orange : Color.Default;
                break;

            case "OUTLINE":
                f9pImage.OutlineColor = e.Segment.IsSelected ? Color.Blue : Color.Default;
                f9pImage.OutlineWidth = e.Segment.IsSelected ? (float)Math.Max(outlineRadiusSlider.Value, 2) : 0;
                break;

            case "SHADOW":
                f9pImage.HasShadow = e.Segment.IsSelected;
                break;

            case "INVERTED":
                f9pImage.ShadowInverted = e.Segment.IsSelected;
                break;

            case "TINT":
                f9pImage.TintColor = e.Segment.IsSelected ? Color.Blue : Color.Default;
                break;
            }
        }
示例#5
0
        void SetBackgroundImage(object sender = null, Forms9Patch.SegmentedControlEventArgs args = null)
        {
            var segment = backgroundImageSelector.SelectedSegments.First();

            if (segment.Text == "NONE")
            {
                ((Forms9Patch.ILayout)Content).BackgroundImage = null;

                /*
                 * absoluteLayout.BackgroundImage = null;
                 * frame.BackgroundImage = null;
                 * grid.BackgroundImage = null;
                 * relativeLayout.BackgroundImage = null;
                 * stackLayout.BackgroundImage = null;
                 */
                return;
            }
            ((Forms9Patch.ILayout)Content).BackgroundImage = new Forms9Patch.Image((ImageSource)segment.IconImage?.Source);

            /*
             * absoluteLayout.BackgroundImage = new Forms9Patch.Image(segment.IconImage?.Source);
             * frame.BackgroundImage = new Forms9Patch.Image(segment.IconImage?.Source);
             * grid.BackgroundImage = new Forms9Patch.Image(segment.IconImage?.Source);
             * relativeLayout.BackgroundImage = new Forms9Patch.Image(segment.IconImage?.Source);
             * stackLayout.BackgroundImage = new Forms9Patch.Image(segment.IconImage?.Source);
             */
            SetFill();
            SetCapsInsets();
            SetAntiAlias();
        }
示例#6
0
        void SetFill(object sender = null, Forms9Patch.SegmentedControlEventArgs args = null)
        {
            if (((Forms9Patch.ILayout)Content).BackgroundImage != null)
            {
                var text = fillSegmentedControl.SelectedSegments.First().Text;

                var fill = Forms9Patch.Fill.Fill;
                if (text == "TILE")
                {
                    fill = Forms9Patch.Fill.Tile;
                }
                else if (text == "ASPECTFILL")
                {
                    fill = Forms9Patch.Fill.AspectFill;
                }
                else if (text == "ASPECTFIT")
                {
                    fill = Forms9Patch.Fill.AspectFit;
                }
                ((Forms9Patch.ILayout)Content).BackgroundImage.Fill = fill;

                /*
                 * absoluteLayout.BackgroundImage.Fill = fill;
                 * frame.BackgroundImage.Fill = fill;
                 * grid.BackgroundImage.Fill = fill;
                 * relativeLayout.BackgroundImage.Fill = fill;
                 * stackLayout.BackgroundImage.Fill = fill;*/
            }
        }
示例#7
0
        void SetVtLayoutOptions(object sender = null, Forms9Patch.SegmentedControlEventArgs args = null)
        {
            var text         = vtOptionSegmentedControl.SelectedSegments.First().Text;
            var layoutOption = LayoutOptions.Fill;

            if (text == "START")
            {
                layoutOption = LayoutOptions.Start;
            }
            else if (text == "CENTER")
            {
                layoutOption = LayoutOptions.Center;
            }
            else if (text == "END")
            {
                layoutOption = LayoutOptions.End;
            }
            Content.VerticalOptions = layoutOption;

            /*
             * absoluteLayout.VerticalOptions = layoutOption;
             * frame.VerticalOptions = layoutOption;
             * grid.VerticalOptions = layoutOption;
             * relativeLayout.VerticalOptions = layoutOption;
             * stackLayout.VerticalOptions = layoutOption;
             */
        }
示例#8
0
 void SetCapsUnits(object sender = null, Forms9Patch.SegmentedControlEventArgs args = null)
 {
     if (capsUnitsSegmentedControl.IsIndexSelected(0))
     {
         capsInsetsLeftSlider.Maximum   = 200;
         capsInsetsLeftSlider.Value     = 0;
         capsInsetsRightSlider.Maximum  = 200;
         capsInsetsRightSlider.Value    = 0;
         capsInsetsTopSlider.Maximum    = 200;
         capsInsetsTopSlider.Value      = 0;
         capsInsetsBottomSlider.Maximum = 200;
         capsInsetsBottomSlider.Value   = 0;
     }
     else
     {
         capsInsetsLeftSlider.Maximum   = 100;
         capsInsetsLeftSlider.Value     = 0;
         capsInsetsRightSlider.Maximum  = 100;
         capsInsetsRightSlider.Value    = 0;
         capsInsetsTopSlider.Maximum    = 100;
         capsInsetsTopSlider.Value      = 0;
         capsInsetsBottomSlider.Maximum = 100;
         capsInsetsBottomSlider.Value   = 0;
     }
     SetCapsInsets();
 }
示例#9
0
        private void HzOptionSegmentedControl_SegmentTapped(object sender, Forms9Patch.SegmentedControlEventArgs e)
        {
            switch (e.Segment.Text)
            {
            case "START":
                hzOptionSegmentedControl.SelectIndex(0);
                _f9pButton.HorizontalOptions = (hzOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.StartAndExpand : LayoutOptions.Start);
                hzOptionSegmentedControl.DeselectIndex(1);
                hzOptionSegmentedControl.DeselectIndex(2);
                hzOptionSegmentedControl.DeselectIndex(3);
                break;

            case "CENTER":
                hzOptionSegmentedControl.SelectIndex(1);
                _f9pButton.HorizontalOptions = (hzOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.CenterAndExpand : LayoutOptions.Center);
                hzOptionSegmentedControl.DeselectIndex(0);
                hzOptionSegmentedControl.DeselectIndex(2);
                hzOptionSegmentedControl.DeselectIndex(3);
                break;

            case "END":
                hzOptionSegmentedControl.SelectIndex(2);
                _f9pButton.HorizontalOptions = (hzOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.EndAndExpand : LayoutOptions.End);
                hzOptionSegmentedControl.DeselectIndex(0);
                hzOptionSegmentedControl.DeselectIndex(1);
                hzOptionSegmentedControl.DeselectIndex(3);
                break;

            case "FILL":

                hzOptionSegmentedControl.SelectIndex(3);
                _f9pButton.HorizontalOptions = (hzOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.FillAndExpand : LayoutOptions.Fill);
                hzOptionSegmentedControl.DeselectIndex(0);
                hzOptionSegmentedControl.DeselectIndex(1);
                hzOptionSegmentedControl.DeselectIndex(2);
                break;

            case "EXPAND":
                _f9pButton.HorizontalOptions = new LayoutOptions(_f9pButton.HorizontalOptions.Alignment, e.Segment.IsSelected);
                break;
            }
            _xfButton.HorizontalOptions = _f9pButton.HorizontalOptions;
        }
示例#10
0
        private void VtOptionSegmentedControl_SegmentTapped(object sender, Forms9Patch.SegmentedControlEventArgs e)
        {
            switch (e.Segment.Text)
            {
            case "START":
                vtOptionSegmentedControl.SelectIndex(0);
                f9pImage.VerticalOptions = (vtOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.StartAndExpand : LayoutOptions.Start);
                vtOptionSegmentedControl.DeselectIndex(1);
                vtOptionSegmentedControl.DeselectIndex(2);
                vtOptionSegmentedControl.DeselectIndex(3);
                break;

            case "CENTER":
                vtOptionSegmentedControl.SelectIndex(1);
                f9pImage.VerticalOptions = (vtOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.CenterAndExpand : LayoutOptions.Center);
                vtOptionSegmentedControl.DeselectIndex(0);
                vtOptionSegmentedControl.DeselectIndex(2);
                vtOptionSegmentedControl.DeselectIndex(3);
                break;

            case "END":
                vtOptionSegmentedControl.SelectIndex(2);
                f9pImage.VerticalOptions = (vtOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.EndAndExpand : LayoutOptions.End);
                vtOptionSegmentedControl.DeselectIndex(0);
                vtOptionSegmentedControl.DeselectIndex(1);
                vtOptionSegmentedControl.DeselectIndex(3);
                break;

            case "FILL":
                vtOptionSegmentedControl.SelectIndex(3);
                f9pImage.VerticalOptions = (vtOptionSegmentedControl.IsIndexSelected(4) ? LayoutOptions.FillAndExpand : LayoutOptions.Fill);
                vtOptionSegmentedControl.DeselectIndex(0);
                vtOptionSegmentedControl.DeselectIndex(1);
                vtOptionSegmentedControl.DeselectIndex(2);
                break;

            case "EXPAND":
                f9pImage.VerticalOptions = new LayoutOptions(f9pImage.VerticalOptions.Alignment, e.Segment.IsSelected);
                break;
            }
            xamarinImage.VerticalOptions = f9pImage.VerticalOptions;
        }
示例#11
0
        private void ShapesSelector_SegmentTapped(object sender, Forms9Patch.SegmentedControlEventArgs e)
        {
            var shape = Forms9Patch.ElementShape.Rectangle;

            if (e.Segment.Text == Square)
            {
                shape = Forms9Patch.ElementShape.Square;
            }
            else if (e.Segment.Text == Circle)
            {
                shape = Forms9Patch.ElementShape.Circle;
            }
            else if (e.Segment.Text == Ellipse)
            {
                shape = Forms9Patch.ElementShape.Elliptical;
            }
            else if (e.Segment.Text == "OBROUND")
            {
                shape = Forms9Patch.ElementShape.Obround;
            }
            _f9pButton.ElementShape = shape;
        }
示例#12
0
 private void BackgroundImageSelector_SegmentTapped(object sender, Forms9Patch.SegmentedControlEventArgs e)
 {
     _f9pImage.Source = e.Segment.IconImage?.Source;
     _xfImage.Source  = e.Segment.IconImage?.Source;
 }
示例#13
0
 void OnSegmentLongPressed(object sender, Forms9Patch.SegmentedControlEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("LongPressed Segment[" + e.Index + "] Text=[" + e.Segment.Text + "]");
 }
示例#14
0
 static void OnSegmentSelected(object sender, Forms9Patch.SegmentedControlEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("Selected Segment[" + e.Index + "] Text=[" + e.Segment.HtmlText + "]");
 }
示例#15
0
        void SetShapeAttributes(object sender = null, Forms9Patch.SegmentedControlEventArgs args = null)
        {
            foreach (var segment in shapeAttributesSelector.Segments)
            {
                switch (segment.Text)
                {
                case "BACKGROUND":
                    var backgroundColor = segment.IsSelected ? Color.Green : Color.Default;
                    ((Forms9Patch.ILayout)Content).BackgroundColor = backgroundColor;

                    /*
                     * absoluteLayout.BackgroundColor = backgroundColor;
                     * frame.BackgroundColor = backgroundColor;
                     * grid.BackgroundColor = backgroundColor;
                     * relativeLayout.BackgroundColor = backgroundColor;
                     * stackLayout.BackgroundColor = backgroundColor;
                     */
                    break;

                case "OUTLINE":
                    var outlineColor = segment.IsSelected ? Color.Blue : Color.Default;
                    ((Forms9Patch.ILayout)Content).OutlineColor = outlineColor;

                    /*
                     * absoluteLayout.OutlineColor = outlineColor;
                     * frame.OutlineColor = outlineColor;
                     * grid.OutlineColor = outlineColor;
                     * relativeLayout.OutlineColor = outlineColor;
                     * stackLayout.OutlineColor = outlineColor;
                     */
                    var outlineWidth = segment.IsSelected ? (float)Math.Max(outlineWidthSlider.Value, 2) : 0;
                    ((Forms9Patch.ILayout)Content).OutlineWidth = outlineWidth;

                    /*
                     * absoluteLayout.OutlineWidth = outlineWidth;
                     * frame.OutlineWidth = outlineWidth;
                     * grid.OutlineWidth = outlineWidth;
                     * relativeLayout.OutlineWidth = outlineWidth;
                     * stackLayout.OutlineWidth = outlineWidth;
                     */
                    break;

                case "SHADOW":
                    ((Forms9Patch.ILayout)Content).HasShadow = segment.IsSelected;

                    /*
                     * absoluteLayout.HasShadow = segment.IsSelected;
                     * frame.HasShadow = segment.IsSelected;
                     * grid.HasShadow = segment.IsSelected;
                     * relativeLayout.HasShadow = segment.IsSelected;
                     * stackLayout.HasShadow = segment.IsSelected;
                     */
                    break;

                case "INVERTED":
                    ((Forms9Patch.ILayout)Content).ShadowInverted = segment.IsSelected;

                    /*
                     * absoluteLayout.ShadowInverted = segment.IsSelected;
                     * frame.ShadowInverted = segment.IsSelected;
                     * grid.ShadowInverted = segment.IsSelected;
                     * relativeLayout.ShadowInverted = segment.IsSelected;
                     * stackLayout.ShadowInverted = segment.IsSelected;
                     */
                    break;
                }
            }
        }
示例#16
0
 private void OnSegmentSelected(object sender, Forms9Patch.SegmentedControlEventArgs e)
 => UpdateItemsSource();