using System; namespace Shared.Phone.Device.CommonForm { /// /// 图片在左边,文字在右边,带下划线的行控件 /// public class ACLeftIconButtonRowLayout : FrameLayout { #region ◆ 变量__________________________ /// /// 图片 /// public Button IconButton; /// /// 标题 /// public Button TitleButton; /// /// 下划线 /// public FrameLayout lineFrameLayout; #endregion #region ◆ 构造方法_______________________ public ACLeftIconButtonRowLayout() { } #endregion #region ◆ 初始化__________________________ /// /// 初始化--部分参数先写死吧 /// /// Icon path. /// Icon selected path. /// Title. public void Init(string iconPath, string iconSelectedPath, string title, bool hadLine = true) { IconButton = new Button() { X = Application.GetRealWidth(80), Height = Application.GetMinRealAverage(80), Width = Application.GetMinRealAverage(80), UnSelectedImagePath = iconPath, SelectedImagePath = iconSelectedPath, Gravity = Gravity.CenterVertical, Tag = this.Tag }; AddChidren(IconButton); TitleButton = new Button() { X = IconButton.Right + Application.GetRealWidth(30), Height = Application.GetRealHeight(80), Width = this.Width - Application.GetRealWidth(80 + 80 + 30), TextColor = Shared.Common.ZigbeeColor.Current.GXCPlaceHolderTextColor, SelectedTextColor = Common.ZigbeeColor.Current.GXCACSelectedTextColor_FanModel, Text = title, TextAlignment = TextAlignment.CenterLeft, Gravity = Gravity.CenterVertical, Tag = this.Tag }; AddChidren(TitleButton); lineFrameLayout = new FrameLayout() { X = IconButton.X, Y = this.Height - 1, Width = this.Width - IconButton.X, Height = 1, BackgroundColor = Common.ZigbeeColor.Current.GXCPlaceHolderTextColor }; if (hadLine) { AddChidren(lineFrameLayout); } } #endregion #region ◆ 选中状态__________________________ /// /// 设置状态 /// /// public void SetStatu(bool statu) { IconButton.IsSelected = statu; TitleButton.IsSelected = statu; } /// /// 选中 /// public void SetSelectedStatu() { IconButton.IsSelected = true; TitleButton.IsSelected = true; } /// /// 不选中 /// public void SetUnSelectedStatu() { IconButton.IsSelected = false; TitleButton.IsSelected = false; } #endregion } }