Exemplo n.º 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;
 }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }