Пример #1
0
 public void SetItems(IEnumerable <DrawerRightSelectData> items, Action <DrawerRightSelectData, DrawerRightSelectData> onSelected, DrawerRightSelectData current = null)
 {
     this.ItemsSource = null;
     this.ItemsSource = DrawerRightSelectDataWrapper.CreateItems(items, current);
     _data            = current;
     _onSelected      = onSelected;
 }
Пример #2
0
        private bool Set(DrawerRightSelectDataWrapper data)
        {
            if (data == null)
            {
                return(false);
            }
            if (_data != null && _data.Value.Equals(data.Value))
            {
                return(false);
            }

            var items = this.Items;

            foreach (DrawerRightSelectDataWrapper item in items)
            {
                item.Selected = item.Value.Equals(data.Value);
            }

            var texts = this.GetChilds <RangeText>();

            foreach (var text in texts)
            {
                var t = text.DataContext as DrawerRightSelectDataWrapper;
                if (t.Value.Equals(data.Value))
                {
                    _data                = t;
                    text.IsFiexdFocus    = true;
                    text.ImageVisibility = Visibility.Visible;
                }
                else
                {
                    text.IsFiexdFocus    = false;
                    text.ImageVisibility = Visibility.Hidden;
                }
            }

            _data = data;
            return(true);
        }
Пример #3
0
        public static IEnumerable <DrawerRightSelectDataWrapper> CreateItems(IEnumerable <DrawerRightSelectData> datas, DrawerRightSelectData current = null)
        {
            List <DrawerRightSelectDataWrapper> items = new List <DrawerRightSelectDataWrapper>(datas.Count());

            foreach (var data in datas)
            {
                var item = new DrawerRightSelectDataWrapper(data);
                item.Selected = current != null && item.Value.Equals(current.Value);
                items.Add(item);
            }
            return(items);
        }
Пример #4
0
 public DrawerRightSelectDataWrapper(DrawerRightSelectData data)
     : base(data.Value, data.Text, data.SubText)
 {
     this.Selected = false;
 }