Beispiel #1
0
        private void AddCustomToolbarItems()
        {
            ObservableCollection <object> collection = new ObservableCollection <object>();

            collection.Add(ToolbarOptions.Bold);
            collection.Add(ToolbarOptions.Italic);
            collection.Add(ToolbarOptions.Underline);
            collection.Add(ToolbarOptions.NumberList);
            collection.Add(ToolbarOptions.BulletList);

            if (Device.RuntimePlatform != Device.iOS)
            {
                readOnlyButton = new CustomItem.SfButton();
                readOnlyButton.BackgroundColor = Color.Transparent;
                readOnlyButton.TextColor       = Color.FromHex("#DE333333");
                if (Device.RuntimePlatform == Device.Android)
                {
                    readOnlyButton.HeightRequest = 44;
                    readOnlyButton.FontFamily    = "Text edit 2.ttf#";
                    readOnlyButton.Text          = "\ue702";
                }
                else if (Device.RuntimePlatform == Device.UWP)
                {
                    readOnlyButton.FontFamily = "Text edit 2.ttf#Text edit 2";
                    readOnlyButton.Text       = "\ue700";
                }
                readOnlyButton.FontSize = 18;
                readOnlyButton.Clicked += ReadOnlyButton_Clicked;
                collection.Add(readOnlyButton);

                emojiButton = CreateButton("\U0001F642");
                emojiButton.VerticalTextAlignment = TextAlignment.Center;
                emojiButton.Clicked += EmojiButton_Clicked;
                if (Device.RuntimePlatform == Device.UWP)
                {
                    emojiButton.BorderColor = Color.Transparent;
                }

                collection.Add(emojiButton);
            }
            else
            {
                Button readonlyButtonIOS = new Button();
                readonlyButtonIOS.FontFamily = "Text edit 2";
                readonlyButtonIOS.Text       = "\ue700";
                readonlyButtonIOS.TextColor  = Color.FromHex("#DE333333");
                readonlyButtonIOS.Clicked   += ReadonlyButtonIOS_Clicked;;
                collection.Add(readonlyButtonIOS);

                emojiButtonIOS          = new Button();
                emojiButtonIOS.Text     = "\U0001F642";
                emojiButtonIOS.Clicked += EmojiButtonIOS_Clicked;
                collection.Add(emojiButtonIOS);
            }

            RTE.ToolbarItems = collection;
        }
Beispiel #2
0
 CustomItem.SfButton CreateButton(string text)
 {
     CustomItem.SfButton button = new CustomItem.SfButton();
     if (Device.RuntimePlatform == Device.Android)
     {
         button.HeightRequest = 44;
     }
     button.BackgroundColor = Color.Transparent;
     button.TextColor       = Color.FromHex("#DE333333");
     if (Device.RuntimePlatform == Device.Android)
     {
         button.FontFamily = "android";
         button.FontSize   = 18;
     }
     else if (Device.RuntimePlatform == Device.UWP)
     {
         button.FontFamily = "V3 Xamarin iOS uwp new.ttf#V3 Xamarin iOS uwp new";
     }
     button.Text = text;
     return(button);
 }