コード例 #1
0
        public MainPage()
        {
            InitializeComponent();
            Assembly assembly = typeof(App).GetTypeInfo().Assembly;

            imageEditor.Source            = ImageSource.FromResource("ImageEditor_CustomView.Buldingimage.jpeg", assembly);
            imageEditor.RotatableElements = ImageEditorElements.CustomView;
            var footerToolbarItem = new FooterToolbarItem()
            {
                Icon = ImageSource.FromResource("ImageEditor_CustomView.Icons.ITypogy3.png"), Text = "CustomView"
            };

            footerToolbarItem.SubItems = new ObservableCollection <Syncfusion.SfImageEditor.XForms.ToolbarItem>()
            {
                new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                {
                    Name = "CustomView1", Icon = ImageSource.FromResource("ImageEditor_CustomView.Icons.ITypogy1.png"), Text = "ITypogy1"
                },
                new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                {
                    Name = "CustomView2", Icon = ImageSource.FromResource("ImageEditor_CustomView.Icons.ITypogy2.png"), Text = "ITypogy2"
                }
            };
            imageEditor.ToolbarSettings.ToolbarItems.Add(footerToolbarItem);

            imageEditor.ToolbarSettings.ToolbarItemSelected += ToolbarSettings_ToolbarItemSelected;
        }
コード例 #2
0
        public override void ViewDidAppear(bool animated)
        {
            base.ViewDidAppear(animated);

            presentController = GetVisibleViewController();
            imageEditor = new SfImageEditor(new CGRect(View.Frame.Location.X, 60, View.Frame.Size.Width, View.Frame.Size.Height - 60));
            imageEditor.SetToolbarItemVisibility("text,transform,shape,path,effects", false);

            CustomViewItems = new List<ToolbarItem>()
            {
                new CustomToolbarItem(){ CustomName = "Typogy1",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy1.png"),IconHeight=70 },
                new CustomToolbarItem(){CustomName = "Typogy2",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy2.png"),IconHeight=70  },
                new CustomToolbarItem(){CustomName = "Typogy3",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy3.png"),IconHeight=70  },
                new CustomToolbarItem(){CustomName = "Typogy4",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy4.png"),IconHeight=70  },
 new CustomToolbarItem(){CustomName = "Typogy5",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy5.png"),IconHeight=70  },
 new CustomToolbarItem(){CustomName = "Typogy6",Icon=UIImage.FromBundle("Images/ImageEditor/ITypogy6.png"),IconHeight=70  },
            };

            // Add the custom tool bar items
            var item1 = new FooterToolbarItem()
            {
                Text = "Add",
                Icon = UIImage.FromBundle("Images/ImageEditor/AddIcon.png"),
                SubItems = CustomViewItems,
                TextHeight = 20,
            };

            var item2 = new FooterToolbarItem()
            {
                Text = "Replace",
                Icon = UIImage.FromBundle("Images/ImageEditor/ReplaceIcon.png"),
                SubItems = CustomViewItems,
                TextHeight = 20
            };

            var item3 = new FooterToolbarItem()
            {
                Icon = UIImage.FromBundle("Images/ImageEditor/BringFrontIcon"),
                Text = "Bring Front",
                TextHeight = 20
            };

            var item4 = new FooterToolbarItem()
            {
                Icon = UIImage.FromBundle("Images/ImageEditor/SendBack"),
                Text = "Send Back",
                TextHeight = 20
            };
            imageEditor.ToolBarSettings.ToolbarItems.Add(item1);
            imageEditor.ToolBarSettings.ToolbarItems.Add(item2);
            imageEditor.ToolBarSettings.ToolbarItems.Add(item3);
            imageEditor.ToolBarSettings.ToolbarItems.Add(item4);
            imageEditor.ToolBarSettings.SubItemToolbarHeight = 70;
            imageEditor.ItemSelected += ImageEditor_ItemSelected;
            imageEditor.ToolBarSettings.ToolbarItemSelected += OnToolbarItemSelected;
            imageEditor.Image = image;
            this.View.AddSubview(imageEditor);

        }
コード例 #3
0
        private void NewImageEditor(IRandomAccessStream stream)
        {
            imgeditor.Image = stream as FileRandomAccessStream;
            frontPage.Visibility = Visibility.Collapsed;
            imageEditorPage.Visibility = Visibility.Visible;
            imgeditor.SetToolbarItemVisibility("text, save,redo,undo,reset,path,shape,transform", false);

            banner = new FooterToolbarItem()
            {
                Text = "Banner Types",
                SubItems = new System.Collections.ObjectModel.ObservableCollection<Syncfusion.UI.Xaml.ImageEditor.ToolbarItem>()
                {
                    new Syncfusion.UI.Xaml.ImageEditor.ToolbarItem(){Text="Facebook Post"},
                    new Syncfusion.UI.Xaml.ImageEditor.ToolbarItem(){Text="Facebook Cover" },
                    new Syncfusion.UI.Xaml.ImageEditor.ToolbarItem(){Text="Twitter Cover" },
                    new Syncfusion.UI.Xaml.ImageEditor.ToolbarItem(){Text="Twitter Post" },
                    new Syncfusion.UI.Xaml.ImageEditor.ToolbarItem(){Text="YouTubeChannel Cover"},
                },
            };

            item1 = new CustomHeader();
            item = new FooterToolbarItem();
            imgeditor.ToolbarSettings.ToolbarItems.Add(banner);
            item1.HeaderName = "Share";
            BitmapImage bitmap = new BitmapImage(new Uri("ms-appx:/Image/View/Assets/share.png"));

            item1.Icon =  bitmap;
            item1.IconHeight = 15;
            imgeditor.ToolbarSettings.ToolbarItems.Add(item);
            imgeditor.ToolbarSettings.ToolbarItems.Add(item1);
            imgeditor.ToolbarSettings.ToolbarItemSelected += (sender, e) =>
            {
                if (e.ToolbarItem is CustomHeader)
                    if ((e.ToolbarItem as CustomHeader).HeaderName == "Share")
                    {
                        Share();
                    }
                if (e.ToolbarItem is Syncfusion.UI.Xaml.ImageEditor.ToolbarItem)
                {
                    var toolitem = e.ToolbarItem as UI.Xaml.ImageEditor.ToolbarItem;
                    if (toolitem.Text == "Facebook Post" || toolitem.Text == "Banner Types")
                        imgeditor.ToggleCropping(1200, 900);
                    else if (toolitem.Text == "Facebook Cover")
                        imgeditor.ToggleCropping(851, 315);
                    else if (toolitem.Text == "Twitter Cover")
                        imgeditor.ToggleCropping(1500, 500);
                    else if (toolitem.Text == "Twitter Post")
                        imgeditor.ToggleCropping(1024, 512);
                    else if (toolitem.Text == "YouTubeChannel Cover")
                        imgeditor.ToggleCropping(2560, 1440);
                }
            };
        }
コード例 #4
0
            protected override void OnCreate(Bundle savedInstanceState)
            {
                imageEditor = new SfImageEditor(this);
                imageEditor.ToolbarSettings.ToolbarItemSelected += OnToolbarItemSelected;
                imageEditor.ImageSaving += ImageEditor_ImageSaving;
                imageEditor.ImageLoaded += ImageEditor_ImageLoaded;

                Android.Graphics.Drawables.BitmapDrawable bd = (Android.Graphics.Drawables.BitmapDrawable)ProfileEditor.ImageView.Drawable;
                imageEditor.Bitmap = bd.Bitmap;
                SetContentView(imageEditor);
                base.OnCreate(savedInstanceState);

                imageEditor.SetToolbarItemVisibility("Text, Shape, Brightness, Effects, Bradley Hand, Path, 3:1, 3:2, 4:3, 5:4, 16:9, Undo, Redo, Transform", false);

                // Add the custom tool bar items
                var item = new FooterToolbarItem()
                {
                    Text       = "Crop",
                    TextHeight = 20,
                };

                imageEditor.ToolbarSettings.ToolbarItems.Add(item);
            }
コード例 #5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            viewModel = new ViewModel();
            assets    = this.Assets;
            LayoutInflater layoutInflater = LayoutInflater.From(this);

            view = layoutInflater.Inflate(Resource.Layout.EditorBannerMain, null);
            SetContentView(view);
            LinearLayout mainLayout = FindViewById <LinearLayout>
                                          (Resource.Id.editor_layout);

            visibilityLayout = FindViewById <LinearLayout>
                                   (Resource.Id.visibility_layout);
            visibilityLayout.Visibility = ViewStates.Gone;
            Button ok = FindViewById <Button>
                            (Resource.Id.button);
            Button cancel = FindViewById <Button>
                                (Resource.Id.button2);

            ok.Click     += Ok_Click;
            cancel.Click += Cancel_Click;
            editor        = new SfImageEditor(this);
            editor.Bitmap = BannerCreator.Image;
            mainLayout.AddView(editor);

            editor.ToolbarSettings.ToolbarItems.Clear();
            FooterToolbarItem banner = new FooterToolbarItem()
            {
                Text     = "Banner Types",
                SubItems = new List <ToolbarItem>()
                {
                    new ToolbarItem()
                    {
                        Text = "Facebook Post"
                    },
                    new ToolbarItem()
                    {
                        Text = "Facebook Cover"
                    },
                    new ToolbarItem()
                    {
                        Text = "Twitter Cover"
                    },
                    new ToolbarItem()
                    {
                        Text = "Twitter Post"
                    },
                    new ToolbarItem()
                    {
                        Text = "YouTubeChannel Cover"
                    },
                },
            };


            HeaderToolbarItem item2 = new HeaderToolbarItem();

            item2.Text = "Share";
            item2.Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.share);
            HeaderToolbarItem crop = new HeaderToolbarItem();

            crop.Text = "Banner Types";
            editor.ToolbarSettings.ToolbarItems.Add(item2);
            editor.ToolbarSettings.ToolbarItems.Add(banner);
            editor.ToolbarSettings.ToolbarItemSelected += (sender, e) =>
            {
                if (e.ToolbarItem is HeaderToolbarItem)
                {
                    if ((e.ToolbarItem as HeaderToolbarItem).Text == "Share")
                    {
                        ShareImage();
                    }
                }
                if (e.ToolbarItem is ToolbarItem)
                {
                    var toolitem = e.ToolbarItem as ToolbarItem;
                    if (toolitem.Text != "Banner Types" && toolitem.Text != "Share")
                    {
                        visibilityLayout.Visibility = ViewStates.Visible;
                    }
                    if (toolitem.Text == "Facebook Post")
                    {
                        editor.ToggleCropping(1200, 900);
                    }
                    else if (toolitem.Text == "Facebook Cover")
                    {
                        editor.ToggleCropping(851, 315);
                    }
                    else if (toolitem.Text == "Twitter Cover")
                    {
                        editor.ToggleCropping(1500, 500);
                    }
                    else if (toolitem.Text == "Twitter Post")
                    {
                        editor.ToggleCropping(1024, 512);
                    }
                    else if (toolitem.Text == "YouTubeChannel Cover")
                    {
                        editor.ToggleCropping(2560, 1440);
                    }
                }
            };



            base.OnCreate(savedInstanceState);
        }
コード例 #6
0
        public CustomView()
        {
            this.InitializeComponent();
            editor.SetToolbarItemVisibility("text, transform, shape, path", false);

            CustomViewItems = new ObservableCollection <ToolbarItem>()
            {
                new CustomToolbarItem()
                {
                    Icon = new BitmapImage(new Uri("ms-appx:/Image/View/Assets/ITypogy1.png")), CustomName = "ITypogy1", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = new BitmapImage(new Uri("ms-appx:/Image/View/Assets/ITypogy2.png")), CustomName = "ITypogy2", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = new BitmapImage(new Uri("ms-appx:/Image/View/Assets/ITypogy3.png")), CustomName = "ITypogy3", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = new BitmapImage(new Uri("ms-appx:/Image/View/Assets/ITypogy4.png")), CustomName = "ITypogy4", IconHeight = 70
                },
            };

            var item = new FooterToolbarItem()
            {
                Text       = "Add",
                Icon       = new BitmapImage(new Uri("ms-appx:/Image/View/Assets/AddIcon.png")),
                SubItems   = CustomViewItems,
                TextHeight = 20,
            };

            editor.ToolbarSettings.ToolbarItems.Add(item);

            item = new FooterToolbarItem()
            {
                Text       = "Replace",
                Icon       = new BitmapImage(new Uri("ms-appx:/Image/View/Assets/ReplaceIcon.png")),
                SubItems   = CustomViewItems,
                TextHeight = 20
            };
            editor.ToolbarSettings.ToolbarItems.Add(item);

            item = new FooterToolbarItem()
            {
                Icon       = new BitmapImage(new Uri("ms-appx:/Image/View/Assets/BringFrontIcon.png")),
                Text       = "Front",
                TextHeight = 20
            };
            editor.ToolbarSettings.ToolbarItems.Add(item);

            item = new FooterToolbarItem()
            {
                Icon       = new BitmapImage(new Uri("ms-appx:/Image/View/Assets/SendBack.png")),
                Text       = "Back",
                TextHeight = 20
            };
            editor.ToolbarSettings.ToolbarItems.Add(item);
            editor.ToolbarSettings.SubItemToolbarHeight = 70;
            editor.ToolbarSettings.ToolbarItemSelected += OnToolbarItemSelected;
            editor.ItemSelected += ImageEditor_ItemSelected;
        }
コード例 #7
0
        public ImageEditorToolbarPage(ImageSource imagesource, ViewModel viewModel, Model model)
        {
            data                = model;
            ViewModelMain       = viewModel;
            this.BindingContext = ViewModelMain;
            scr = imagesource;
            InitializeComponent();
            imageEditor.Source = imagesource;
            // imageEditor.SetToolbarItemVisibility("Cancel,Ok", false);
            imageEditor.ToolbarSettings.ToolbarItems.Clear();
            imageEditor.EnableZooming = false;
            Assembly          assembly = typeof(ImageSerializeModel).GetTypeInfo().Assembly;
            FooterToolbarItem banner   = new FooterToolbarItem()
            {
                Text     = "Banner Types",
                SubItems = new System.Collections.ObjectModel.ObservableCollection <Syncfusion.SfImageEditor.XForms.ToolbarItem>()
                {
                    #if COMMONSB
                    new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                    {
                        Text = "Facebook Post", Icon = ImageSource.FromResource("SampleBrowser.Icons.fivetofour.png", assembly)
                    },
                    new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                    {
                        Text = "Facebook Cover", Icon = ImageSource.FromResource("SampleBrowser.Icons.fourtothree.png", assembly)
                    },
                    new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                    {
                        Text = "Twitter Cover", Icon = ImageSource.FromResource("SampleBrowser.Icons.fivetofour.png", assembly)
                    },
                    new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                    {
                        Text = "Twitter Post", Icon = ImageSource.FromResource("SampleBrowser.Icons.fourtothree.png", assembly)
                    },
                    new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                    {
                        Text = "YouTubeChannel Cover", Icon = ImageSource.FromResource("SampleBrowser.Icons.fivetofour.png", assembly)
                    },
                    #else
                    new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                    {
                        Text = "Facebook Post", Icon = ImageSource.FromResource("SampleBrowser.SfImageEditor.Icons.fivetofour.png", assembly)
                    },
                    new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                    {
                        Text = "Facebook Cover", Icon = ImageSource.FromResource("SampleBrowser.SfImageEditor.Icons.fourtothree.png", assembly)
                    },
                    new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                    {
                        Text = "Twitter Cover", Icon = ImageSource.FromResource("SampleBrowser.SfImageEditor.Icons.fivetofour.png", assembly)
                    },
                    new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                    {
                        Text = "Twitter Post", Icon = ImageSource.FromResource("SampleBrowser.SfImageEditor.Icons.fourtothree.png", assembly)
                    },
                    new Syncfusion.SfImageEditor.XForms.ToolbarItem()
                    {
                        Text = "YouTubeChannel Cover", Icon = ImageSource.FromResource("SampleBrowser.SfImageEditor.Icons.fivetofour.png", assembly)
                    },
                    #endif
                },
            };


            HeaderToolbarItem item2 = new HeaderToolbarItem();

            item2.Name = "Share";
            #if COMMONSB
            item2.Icon = ImageSource.FromResource("SampleBrowser.Icons.share.png", assembly);
            #else
            item2.Icon = ImageSource.FromResource("SampleBrowser.SfImageEditor.Icons.share.png", assembly);
            #endif
            imageEditor.ToolbarSettings.ToolbarItems.Add(item2);
            imageEditor.ToolbarSettings.ToolbarItems.Add(banner);
            imageEditor.ToolbarSettings.ToolbarItemSelected += (sender, e) =>
            {
                var selected = (e.ToolbarItem as Syncfusion.SfImageEditor.XForms.ToolbarItem);
                if (selected != null)
                {
                    if (selected.Name == "Share")
                    {
                        Share();
                    }
                    else if (selected.Text == "Facebook Post" || selected.Text == "Banner Types")
                    {
                        imageEditor.ToggleCropping(1200, 900);
                    }
                    else if (selected.Text == "Facebook Cover")
                    {
                        imageEditor.ToggleCropping(851, 315);
                    }
                    else if (selected.Text == "Twitter Cover")
                    {
                        imageEditor.ToggleCropping(1500, 500);
                    }
                    else if (selected.Text == "Twitter Post")
                    {
                        imageEditor.ToggleCropping(1024, 512);
                    }
                    else if (selected.Text == "YouTubeChannel Cover")
                    {
                        imageEditor.ToggleCropping(2560, 1440);
                    }
                }
            };
        }
コード例 #8
0
            protected override void OnCreate(Bundle savedInstanceState)
            {
                imageEditor = new SfImageEditor(this);
                var bitmap = BitmapFactory.DecodeResource(Resources, ImageEditorCustomView.Image);

                imageEditor.Bitmap        = bitmap;
                imageEditor.ItemSelected += ImageEditor_ItemSelected;
                SetContentView(imageEditor);
                base.OnCreate(savedInstanceState);

                imageEditor.SetToolbarItemVisibility("text,transform,shape,path,effects", false);

                CustomViewItems = new List <ToolbarItem>()
                {
                    new CustomToolbarItem()
                    {
                        Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy1), CustomName = "ITypogy1", IconHeight = 70
                    },
                    new CustomToolbarItem()
                    {
                        Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy2), CustomName = "ITypogy2", IconHeight = 70
                    },
                    new CustomToolbarItem()
                    {
                        Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy3), CustomName = "ITypogy3", IconHeight = 70
                    },
                    new CustomToolbarItem()
                    {
                        Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy4), CustomName = "ITypogy4", IconHeight = 70
                    },
                    new CustomToolbarItem()
                    {
                        Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy5), CustomName = "ITypogy5", IconHeight = 70
                    },
                    new CustomToolbarItem()
                    {
                        Icon = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ITypogy6), CustomName = "ITypogy6", IconHeight = 70
                    }
                };

                // Add the custom tool bar items
                var item = new FooterToolbarItem()
                {
                    Text       = "Add",
                    Icon       = BitmapFactory.DecodeResource(Resources, Resource.Drawable.AddIcon),
                    SubItems   = CustomViewItems,
                    TextHeight = 20,
                };

                imageEditor.ToolbarSettings.ToolbarItems.Add(item);

                item = new FooterToolbarItem()
                {
                    Text       = "Replace",
                    Icon       = BitmapFactory.DecodeResource(Resources, Resource.Drawable.ReplaceIcon),
                    SubItems   = CustomViewItems,
                    TextHeight = 20
                };
                imageEditor.ToolbarSettings.ToolbarItems.Add(item);

                item = new FooterToolbarItem()
                {
                    Icon       = BitmapFactory.DecodeResource(Resources, Resource.Drawable.BringFrontIcon),
                    Text       = "Bring Front",
                    TextHeight = 20
                };
                imageEditor.ToolbarSettings.ToolbarItems.Add(item);

                item = new FooterToolbarItem()
                {
                    Icon       = BitmapFactory.DecodeResource(Resources, Resource.Drawable.SendBack),
                    Text       = "Send Back",
                    TextHeight = 20
                };
                imageEditor.ToolbarSettings.ToolbarItems.Add(item);
                imageEditor.ToolbarSettings.SubItemToolbarHeight = 70;
                imageEditor.ToolbarSettings.ToolbarItemSelected += OnToolbarItemSelected;
            }
コード例 #9
0
        public CustomViewHomePage(ImageSource source, CustomViewViewModel viewModel)
        {
            InitializeComponent();
            this.BindingContext = viewModel;

            // Set source to the SfImageEditor
            imageEditor.Source            = source;
            imageEditor.RotatableElements = ImageEditorElements.CustomView;
            imageEditor.SetToolbarItemVisibility("text,transform,shape,path", false);


            CustomViewItems = new ObservableCollection <Syncfusion.SfImageEditor.XForms.ToolbarItem>()
            {
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy1.png", assembly), CustomName = "ITypogy1", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy2.png", assembly), CustomName = "ITypogy2", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy3.png", assembly), CustomName = "ITypogy3", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy4.png", assembly), CustomName = "ITypogy4", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy5.png", assembly), CustomName = "ITypogy5", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy6.png", assembly), CustomName = "ITypogy6", IconHeight = 70
                }
            };

            // Add the custom tool bar items
            var item = new FooterToolbarItem()
            {
                Text       = "Add",
                Icon       = ImageSource.FromResource(samplePath + "AddIcon.png", assembly),
                SubItems   = CustomViewItems,
                TextHeight = 20,
            };

            imageEditor.ToolbarSettings.ToolbarItems.Add(item);

            item = new FooterToolbarItem()
            {
                Text       = "Replace",
                Icon       = ImageSource.FromResource(samplePath + "ReplaceIcon.png", assembly),
                SubItems   = CustomViewItems,
                TextHeight = 20
            };
            imageEditor.ToolbarSettings.ToolbarItems.Add(item);

            item = new FooterToolbarItem()
            {
                Icon       = ImageSource.FromResource(samplePath + "BringFrontIcon.png", assembly),
                Text       = "Bring Front",
                TextHeight = 20
            };
            imageEditor.ToolbarSettings.ToolbarItems.Add(item);

            item = new FooterToolbarItem()
            {
                Icon       = ImageSource.FromResource(samplePath + "SendBack.png", assembly),
                Text       = "Send Back",
                TextHeight = 20
            };
            imageEditor.ToolbarSettings.ToolbarItems.Add(item);
            imageEditor.ToolbarSettings.SubItemToolbarHeight = 70;
            imageEditor.ItemSelected += ImageEditor_ItemSelected;
            imageEditor.ToolbarSettings.ToolbarItemSelected += OnToolbarItemSelected;
        }
コード例 #10
0
        public CustomViewHomePage(ImageSource source, CustomViewViewModel viewModel)
        {
            InitializeComponent();
            this.BindingContext = viewModel;

            // Set source to the SfImageEditor
            imageEditor.Source            = source;
            imageEditor.RotatableElements = ImageEditorElements.CustomView;
            imageEditor.SetToolbarItemVisibility("text,transform,shape,path,effects", false);


            CustomViewItems = new ObservableCollection <Syncfusion.SfImageEditor.XForms.ToolbarItem>()
            {
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy1.png", assembly), CustomName = "ITypogy1", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy2.png", assembly), CustomName = "ITypogy2", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy3.png", assembly), CustomName = "ITypogy3", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy4.png", assembly), CustomName = "ITypogy4", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy5.png", assembly), CustomName = "ITypogy5", IconHeight = 70
                },
                new CustomToolbarItem()
                {
                    Icon = ImageSource.FromResource(samplePath + "ITypogy6.png", assembly), CustomName = "ITypogy6", IconHeight = 70
                }
            };

            // Add the custom tool bar items
            var item = new FooterToolbarItem()
            {
                Text = "Add",
                Icon = new FontImageSource()
                {
                    Glyph      = "\ue70a",
                    FontFamily = Device.RuntimePlatform == Device.iOS ? "Sync FontIcons" : Device.RuntimePlatform == Device.Android ? "Sync FontIcons.ttf#" : "Sync FontIcons.ttf#Sync FontIcons",
                    Color      = Color.Black
                },
                SubItems   = CustomViewItems,
                TextHeight = 20,
            };

            imageEditor.ToolbarSettings.ToolbarItems.Add(item);

            item = new FooterToolbarItem()
            {
                Text       = "Replace",
                IconHeight = Device.RuntimePlatform == Device.Android ? 27 : double.NaN,
                Icon       = new FontImageSource()
                {
                    Glyph      = "\ue740",
                    FontFamily = Device.RuntimePlatform == Device.iOS ? "SB Icons" : Device.RuntimePlatform == Device.Android ? "SB Icons.ttf#" : "SB Icons.ttf#SB Icons",
                    Color      = Color.Black
                },
                SubItems   = CustomViewItems,
                TextHeight = 20
            };
            imageEditor.ToolbarSettings.ToolbarItems.Add(item);

            item = new FooterToolbarItem()
            {
                Icon = new FontImageSource()
                {
                    Glyph      = "\ue764",
                    FontFamily = Device.RuntimePlatform == Device.iOS ? "Sync FontIcons" : Device.RuntimePlatform == Device.Android ? "Sync FontIcons.ttf#" : "Sync FontIcons.ttf#Sync FontIcons",
                    Color      = Color.Black
                },
                Text       = "Bring Front",
                TextHeight = 20
            };
            imageEditor.ToolbarSettings.ToolbarItems.Add(item);

            item = new FooterToolbarItem()
            {
                Icon = new FontImageSource()
                {
                    Glyph      = "\ue70e",
                    FontFamily = Device.RuntimePlatform == Device.iOS ? "Sync FontIcons" : Device.RuntimePlatform == Device.Android ? "Sync FontIcons.ttf#" : "Sync FontIcons.ttf#Sync FontIcons",
                    Color      = Color.Black
                },
                Text       = "Send Back",
                TextHeight = 20
            };
            imageEditor.ToolbarSettings.ToolbarItems.Add(item);
            imageEditor.ToolbarSettings.SubItemToolbarHeight = 70;
            imageEditor.ItemSelected += ImageEditor_ItemSelected;
            imageEditor.ToolbarSettings.ToolbarItemSelected += OnToolbarItemSelected;
        }