2 using System.Collections;
3 using System.Collections.Generic;
4 using Tizen.NUI.Binding;
6 namespace Tizen.NUI.Xaml
8 [ContentProperty("Items")]
9 [AcceptEmptyServiceProvider]
10 internal class ArrayExtension : IMarkupExtension<Array>
12 public ArrayExtension()
14 Items = new List<object>();
17 public IList Items { get; }
19 public Type Type { get; set; }
21 public Array ProvideValue(IServiceProvider serviceProvider)
24 throw new InvalidOperationException("Type argument mandatory for x:Array extension");
29 var array = Array.CreateInstance(Type, Items.Count);
30 for (var i = 0; i < Items.Count; i++)
31 ((IList)array)[i] = Items[i];
36 object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
38 return (this as IMarkupExtension<Array>).ProvideValue(serviceProvider);