Esempio n. 1
0
        private void TemplateToggleAction()
        {
            if (VideoItemViewCollection != null)
            {
                DataTemplateSelector sed = MyTemplateChange;
                if (sed.GetType() == new itemListSelector().GetType())
                {
                    ViewType = ViewType.Large;
                }
                else
                {
                    ViewType = ViewType.Small;
                }

                this.UpdateViewCollection();
            }
        }
        private bool TemplateToggleAction()
        {
            if (VideoItemViewCollection != null)
            {
                DataTemplateSelector sed = MyTemplateChange;
                if (sed.GetType() == new ItemListSelector().GetType())
                {
                    ApplicationService.AppSettings.ViewType = ViewType.Large;
                }
                else
                {
                    ApplicationService.AppSettings.ViewType = ViewType.Small;
                }

                this.UpdateViewCollection();
                return(true);
            }
            return(false);
        }
        private List <DataTemplate> RegisterCellDataTemplates(DataTemplateSelector dataTemplateSelector)
        {
            var selectorTypeInfo = dataTemplateSelector.GetType().GetTypeInfo();
            var selectorDataTemplatesProperties =
                selectorTypeInfo
                .GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly)
                .Where(p => typeof(DataTemplate).IsAssignableFrom(p.PropertyType));

            foreach (var selectorDataTemplateProperty in selectorDataTemplatesProperties)
            {
                var dataTemplate = (DataTemplate)selectorDataTemplateProperty.GetValue(dataTemplateSelector);

                if (!_registeredDataTemplates.Contains(dataTemplate))
                {
                    _registeredDataTemplates.Add(dataTemplate);
                    Control.RegisterClassForCell(
                        typeof(iOSViewCell),
                        IdentifierFormatter.FormatDataTemplateCellIdentifier(_registeredDataTemplates.Count - 1));
                }
            }

            return(_registeredDataTemplates);
        }