Example #1
0
        protected override bool Init(object controller, object binding, DefinitionFile definition)
        {
            if (!base.Init(controller, binding, definition))
            {
                return(false);
            }

            DefinitionFileWithStyle file = new DefinitionFileWithStyle(definition, typeof(UiListBox));

            _vertical = DefinitionResolver.Get <Mode>(Controller, Binding, file["Mode"], Mode.Vertical) == Mode.Vertical;

            _template = (DefinitionFile)file["Template"];

            _items = (IItemsProvider)DefinitionResolver.GetValueFromMethodOrField(Controller, Binding, file["Items"]);
            _items.Subscribe(this);

            _rule = DefinitionResolver.Get <ScrollingService.ExceedRule>(Controller, Binding, file["ExceedRule"], ScrollingService.ExceedRule.Allow);

            _maxScrollExceed = DefinitionResolver.Get <Length>(Controller, Binding, file["MaxScrollExceed"], ScrollingService.MaxScrollExceed);

            _reverse = DefinitionResolver.Get <bool>(Controller, Binding, file["Reverse"], false);

            _wheelSpeed = (float)DefinitionResolver.Get <double>(Controller, Binding, file["WheelScrollSpeed"], 0);

            _additionalTemplates = file["AdditionalTemplates"] as Dictionary <Type, DefinitionFile>;

            _maxAddOneTime   = DefinitionResolver.Get <int>(Controller, Binding, file["MaxAddOneTime"], 32);
            _maxAddFirstTime = DefinitionResolver.Get <int>(Controller, Binding, file["MaxAddFirstTime"], _maxAddOneTime);

            return(true);
        }
Example #2
0
        protected override bool Init(object controller, object binding, DefinitionFile definition)
        {
            if (!base.Init(controller, binding, definition))
            {
                return(false);
            }

            DefinitionFileWithStyle file = new DefinitionFileWithStyle(definition, typeof(UiQuickList));

            _items = DefinitionResolver.GetValueFromMethodOrField(Controller, Binding, file["Items"]) as IItemsProvider;

            if (_items == null)
            {
                return(false);
            }

            _items.Subscribe(this);

            _rowHeight       = DefinitionResolver.Get <Length>(Controller, Binding, file["RowHeight"], Length.Default);
            _separatorHeight = DefinitionResolver.Get <Length>(Controller, Binding, file["SeparatorHeight"], Length.Zero);

            _maxScrollExceed = DefinitionResolver.Get <Length>(Controller, Binding, file["MaxScrollExceed"], ScrollingService.MaxScrollExceed);
            _reversed        = DefinitionResolver.Get <bool>(Controller, Binding, file["Reversed"], false);

            _wheelSpeed = (float)DefinitionResolver.Get <double>(Controller, Binding, file["WheelScrollSpeed"], 0);
            _rule       = DefinitionResolver.Get <ScrollingService.ExceedRule>(Controller, Binding, file["ExceedRule"], ScrollingService.ExceedRule.Allow);

            _columns = new List <QuickColumnDefinition>();

            List <DefinitionFile> columnsDef = file["Columns"] as List <DefinitionFile>;

            if (columnsDef == null)
            {
                throw new Exception("Columns not defined!");
            }

            foreach (var cd in columnsDef)
            {
                QuickColumnDefinition columnDefinitionObj = cd.CreateInstance(Controller, Binding) as QuickColumnDefinition;
                _columns.Add(columnDefinitionObj);
            }

            DefinitionFile separatorDef = file["Separator"] as DefinitionFile;

            if (separatorDef != null)
            {
                _separator = separatorDef.CreateInstance(Controller, Binding) as QuickSeparator;
            }

            return(true);
        }
Example #3
0
        protected override bool Init(object controller, object binding, DefinitionFile definition)
        {
            if (!base.Init(controller, binding, definition))
            {
                return(false);
            }

            DefinitionFileWithStyle file = new DefinitionFileWithStyle(definition, typeof(UiItemsStack));

            _template = (DefinitionFile)file["Template"];

            _additionalTemplates = file["AdditionalTemplates"] as Dictionary <Type, DefinitionFile>;

            _items = (IItemsProvider)DefinitionResolver.GetValueFromMethodOrField(Controller, Binding, file["Items"]);
            _items.Subscribe(this);

            return(true);
        }