Esempio n. 1
0
        protected virtual Radio GetRadio(object data)
        {
            Radio item = null;

            if (data is Radio)
            {
                item = (Radio)data;
            }
            else
            {
                var isVertical = GetOrientation().Equals(StackOrientation.Vertical);
                item       = new Radio(isVertical);
                item.Value = data;

                if (!string.IsNullOrWhiteSpace(this.DisplayPath))
                {
                    item.SetBinding(Radio.TextProperty, new Binding(this.DisplayPath, source: data));
                }
                else
                {
                    item.Text = data.ToString();
                }
            }

            //item.Size = this.RadioSize;
            item.SetBinding(Radio.SizeProperty, new Binding(nameof(RadioSize), source: this));
            item.SetBinding(Radio.OnImgProperty, new Binding(nameof(OnImg), source: this));
            item.SetBinding(Radio.OffImgProperty, new Binding(nameof(OffImg), source: this));
            item.SetBinding(Radio.TextColorProperty, new Binding(nameof(TextColor), source: this));
            item.SetBinding(Radio.FontSizeProperty, new Binding(nameof(FontSize), source: this));
            if (this.UnSelectedItemControlTemplate != null)
            {
                item.ControlTemplate = this.UnSelectedItemControlTemplate;
            }

            //TapBinder.SetCmd(item, this.SelectedCmd);
            //TapBinder.SetParam(item, item);
            item.SetTap(this.SelectedCmd);

            return(item);
        }
Esempio n. 2
0
        protected virtual Radio GetRadio(object data)
        {
            Radio item = null;

            if (data is Radio)
            {
                item = (Radio)data;
            }
            else
            {
                item       = new Radio();
                item.Value = data;

                if (!string.IsNullOrWhiteSpace(this.DisplayPath))
                {
                    //item.Text = Helper.GetProperty<string>(data, this.DisplayPath, "DisplayPath Invalid");
                    //item.SetBinding(Radio.TextProperty, this.DisplayPath);
                    item.SetBinding(Radio.TextProperty, new Binding(this.DisplayPath, source: data));
                }
                else
                {
                    item.Text = data.ToString();
                }
            }

            item.Size = this.RadioSize;

            if (this.UnSelectedItemControlTemplate != null)
            {
                item.ControlTemplate = this.UnSelectedItemControlTemplate;
            }

            TapBinder.SetCmd(item, this.SelectedCmd);
            TapBinder.SetParam(item, item);

            return(item);
        }