Exemple #1
0
 protected ListBox(Generator generator, Type type, bool initialize = true)
     : base(generator, type, initialize)
 {
     ImageBinding = new ImageListItemImageBinding();
 }
Exemple #2
0
 public Item(IIndirectBinding <string> binding, object value)
 {
     Binding = binding;
     Value   = value;
 }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Forms.ListBox"/> class.
 /// </summary>
 public ListBox()
 {
     ImageBinding = new ImageListItemImageBinding();
 }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Forms.ImageTextCell"/> class when binding to properties via reflection.
 /// </summary>
 /// <param name="imageProperty">Name of the image property in the data item.</param>
 /// <param name="textProperty">Name of the text property in the data item.</param>
 public ImageTextCell(string imageProperty, string textProperty)
 {
     ImageBinding = Eto.Forms.Binding.Property <Image>(imageProperty);
     TextBinding  = Eto.Forms.Binding.Property <string>(textProperty);
 }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Forms.ComboBoxCell"/> class.
 /// </summary>
 public ComboBoxCell()
 {
     ComboTextBinding = new ListItemTextBinding();
     ComboKeyBinding  = new ListItemKeyBinding();
 }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Forms.ImageTextCell"/> class when binding to properties via reflection.
 /// </summary>
 /// <param name="imageProperty">Name of the image property in the data item.</param>
 /// <param name="textProperty">Name of the text property in the data item.</param>
 public ImageTextCell(string imageProperty, string textProperty)
 {
     ImageBinding = new PropertyBinding <Image>(imageProperty);
     TextBinding  = new PropertyBinding <string>(textProperty);
 }
Exemple #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Forms.ImageTextCell"/> class when binding to an indexed-based data item.
 /// </summary>
 /// <param name="imageColumn">Index of the image column in the data item.</param>
 /// <param name="textColumn">Index of the text column in the data item.</param>
 public ImageTextCell(int imageColumn, int textColumn)
 {
     ImageBinding = new ColumnBinding <Image>(imageColumn);
     TextBinding  = new ColumnBinding <string>(textColumn);
 }
Exemple #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Eto.Forms.ListControl"/> class.
 /// </summary>
 protected ListControl()
 {
     TextBinding = new ListItemTextBinding();
     KeyBinding  = new ListItemKeyBinding();
 }
Exemple #9
0
 protected ListControl(Generator g, Type type, bool initialize = true)
     : base(g, type, initialize)
 {
     TextBinding = new ListItemTextBinding();
     KeyBinding  = new ListItemKeyBinding();
 }
Exemple #10
0
 public ComboBoxCell(Generator generator)
     : base(generator, typeof(IHandler), true)
 {
     ComboTextBinding = new ListItemTextBinding();
     ComboKeyBinding  = new ListItemKeyBinding();
 }
 public CanvasThumbnailCell(string property)
 {
     Binding = new PropertyBinding <string>(property);
 }
Exemple #12
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Eto.Forms.ImageTextCell"/> class when binding to properties via reflection.
		/// </summary>
		/// <param name="imageProperty">Name of the image property in the data item.</param>
		/// <param name="textProperty">Name of the text property in the data item.</param>
		public ImageTextCell(string imageProperty, string textProperty)
		{
			ImageBinding = new PropertyBinding<Image>(imageProperty);
			TextBinding = new PropertyBinding<string>(textProperty);
		}
Exemple #13
0
		/// <summary>
		/// Initializes a new instance of the <see cref="Eto.Forms.ImageTextCell"/> class when binding to an indexed-based data item.
		/// </summary>
		/// <param name="imageColumn">Index of the image column in the data item.</param>
		/// <param name="textColumn">Index of the text column in the data item.</param>
		public ImageTextCell(int imageColumn, int textColumn)
		{
			ImageBinding = new ColumnBinding<Image>(imageColumn);
			TextBinding = new ColumnBinding<string>(textColumn);
		}
Exemple #14
0
        public static GridColumn AddDropDownColumn <T>(this GridView view, Func <T, object> value, IEnumerable <object> dataStore, IIndirectBinding <string> textBinding, string header, bool editable = false)
        {
            var  internalBinding = Binding.Delegate(value);
            Cell cell;

            // hack for eto/gtk not supporting ItemTextBinding on ComboBoxCells
            if (Platform.Instance.IsGtk)
            {
                const char zws = '\u200B'; // This is a zero width (ZWS) space Unicode character.

                var lDataStore = dataStore.ToList();

                var tDataStore = lDataStore.Select(i =>
                                                   string.Empty.PadLeft(lDataStore.IndexOf(i) + 1, zws) // Pad with index+1 ZWS chars to be able to check later. If no ZWS is there, this did not work.
                                                   + textBinding.GetValue(i))
                                 .ToList();
                var hasNonUnique = tDataStore.Distinct().Count() != tDataStore.Count; // Check if textBinding produced the same string for more than one data item.

                var binding = Binding.Delegate <T, string>(
                    (T s) => textBinding.GetValue(internalBinding.GetValue(s)),
                    (T t, string s) =>
                {
                    int idx = s.Split(zws).Length - 2;
                    if (idx == -1)
                    {
                        idx = tDataStore.IndexOf(s);     // Fallback if ZWS is not supported.
                        if (hasNonUnique)
                        {
                            throw new Exception("ComboBoxCell ComboTextBinding Polyfill: Duplicate text entry encountered and Zero-Width-Space Hack not supported by platform!");
                        }
                    }

                    internalBinding.SetValue(t, lDataStore[idx]);
                }).Cast <object>();

                cell = new ComboBoxCell {
                    Binding = binding, DataStore = tDataStore
                };
            }
            else
            {
                cell = new ComboBoxCell {
                    Binding = internalBinding, DataStore = dataStore, ComboTextBinding = textBinding
                }
            };

            return(view.AddColumn(cell, header, editable));
        }