public object this[int index]
        {
            get
            {
                /*AdapterItem ai = values[index];
                 * LGView gui = (LGView)LuaEngine.Instance.OnGuiEvent(this, LuaEngine.GuiEvents.GUI_EVENT_ADAPTERVIEW, par, index, ai.data, lastCreatedUI, mLc);
                 * ai.view = gui;
                 #if !NETFX_CORE //We don't need to clone ui on winrt
                 * lastCreatedUI = gui.Clone();
                 #endif
                 * return ai.view.GetView();*/

                AdapterItem ai = values[index];
#if !NETFX_CORE
                if (lastCreatedUI != null && lastCreatedIndex == index && ai.view != null)
                {
                    return(ai.view.GetView());
                }
#endif
                LGView gui = (LGView)LuaEngine.Instance.OnGuiEvent(this, LuaEngine.GuiEvents.GUI_EVENT_ADAPTERVIEW, par, index, ai.data, lastCreatedUI, mLc);
                ai.view       = gui;
                values[index] = ai;
#if !NETFX_CORE
                lastCreatedUI    = gui.Clone();
                lastCreatedIndex = index;
#endif
                return(ai.view.GetView());
            }
            set
            {
                throw new NotImplementedException();
            }
        }
        public void AddValue(Int32 id, Object value)
        {
            AdapterItem ai = new AdapterItem();

            ai.id   = id;
            ai.data = value;
            values.Add(ai);
            if (CollectionChanged != null)
            {
                CollectionChanged.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, value, id));
            }
        }
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            AdapterItem ai = (AdapterItem)item;

#if WINDOWS_PHONE
            SLaB.Utilities.Xaml.Serializer.UI.
            UiXamlSerializer uxs          = new UiXamlSerializer();
            String           xaml         = uxs.Serialize(ai.view.GetView());
            DataTemplate     datatemplate = (DataTemplate)XamlReader.Load(xaml);
            return(datatemplate);
#else
            ai.view.GetView();
            return(null);
#endif
        }