using Syncfusion.XForms.PopupLayout;
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace BootCom.XamForms.Core.Controls
{
public class ColourEntry : StackLayout
{
public static readonly BindableProperty ColourProperty = BindableProperty.Create("Colour", typeof(Color), typeof(Color));
public SfPopupLayout ColourPopup { get; internal set; }
public Entry ValueEntry { get; internal set; }
public Button ValueButton { get; internal set; }
public ColourEntry()
{
this.Orientation = StackOrientation.Horizontal;
ValueEntry = new Entry();
ValueButton = new Button() { Text = "Select" };
this.Children.Add(ValueEntry);
this.Children.Add(ValueButton);
ValueButton.Clicked += ValueButton_Clicked;
// Configure the page ...
ColourPopup = new SfPopupLayout();
ColourPopup.PopupView.HeaderTitle = "Select Colour";
var ColourPopupContent = new Grid();
ColourPopupContent.RowDefinitions.Add(new RowDefinition { Height = 40 });
ColourPopupContent.RowDefinitions.Add(new RowDefinition { Height = 40 });
ColourPopupContent.RowDefinitions.Add(new RowDefinition { Height = 40 });
ColourPopupContent.RowDefinitions.Add(new RowDefinition { Height = 40 });
ColourPopupContent.RowDefinitions.Add(new RowDefinition { Height = 40 });
ColourPopupContent.ColumnDefinitions.Add(new ColumnDefinition { Width = 100 });
ColourPopupContent.ColumnDefinitions.Add(new ColumnDefinition());
var LabelA = new Label { Text = "A" };
var LabelR = new Label { Text = "R" };
var LabelG = new Label { Text = "G" };
var LabelB = new Label { Text = "B" };
var Slider_ColA = new Slider();
var Slider_ColR = new Slider();
var Slider_ColG = new Slider();
var Slider_ColB = new Slider();
ColourPopupContent.Children.Add(LabelA, 0, 0);
ColourPopupContent.Children.Add(Slider_ColA, 1, 0);
ColourPopupContent.Children.Add(LabelR, 0, 1);
ColourPopupContent.Children.Add(Slider_ColR, 1, 1);
ColourPopupContent.Children.Add(LabelG, 0, 2);
ColourPopupContent.Children.Add(Slider_ColG, 1, 2);
ColourPopupContent.Children.Add(LabelB, 0, 3);
ColourPopupContent.Children.Add(Slider_ColB, 1, 3);
var datatemplate = new DataTemplate(() => ColourPopupContent);
ColourPopup.PopupView.ContentTemplate = datatemplate;
// ColourPopup.PopupView.HeightRequest = 600;
ColourPopup.Opening += ColourPopup_Opening;
ColourPopup.Closing += ColourPopup_Closing;
}
private void ColourPopup_Opening(object sender, System.ComponentModel.CancelEventArgs e)
{
}
private void ValueButton_Clicked(object sender, EventArgs e)
{
ColourPopup.Show();
// ColourPopup.StaysOpen = true;
}
private void ColourPopup_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
}
}
}