protected void RepDownServers_ItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { DownServerInfo dataItem = (DownServerInfo)e.Item.DataItem; ExtendedLabel label = e.Item.FindControl("LblServerName") as ExtendedLabel; if (dataItem.ShowType == 0) { label.Text = "<a href=\"#\" onclick=\"add('$$$" + dataItem.ServerName + "|" + dataItem.ServerId.ToString() + "')\" >" + dataItem.ServerName + "</a>"; } else { label.Text = string.Concat(new object[] { "<a href=\"#\" onclick=\"add('$$$", dataItem.ServerUrl, "|", dataItem.ServerId.ToString(), "')\" >", dataItem.ServerName, "</a>" }); } this.allDownServer = this.allDownServer + "$$$"; if (dataItem.ShowType == 0) { this.allDownServer = this.allDownServer + dataItem.ServerName; } else { this.allDownServer = this.allDownServer + dataItem.ServerUrl.ToString(); } this.allDownServer = this.allDownServer + "|" + dataItem.ServerId; } }
/// <summary> /// Updates the UI. /// </summary> /// <param name="view"> /// The view. /// </param> /// <param name="control"> /// The control. /// </param> private static void UpdateUi(ExtendedLabel view, UILabel control) { if (!string.IsNullOrEmpty(view.FontName)) { var font = UIFont.FromName( view.FontName, (view.FontSize > 0) ? (float)view.FontSize : 12.0f); if (font != null) { control.Font = font; } } if (!string.IsNullOrEmpty(view.FontNameIOS)) { var font = UIFont.FromName( view.FontNameIOS, (view.FontSize > 0) ? (float)view.FontSize : 12.0f); if (font != null) { control.Font = font; } } if (view.IsUnderline) { control.AttributedText = new NSAttributedString( control.Text, underlineStyle: NSUnderlineStyle.Single); } }
void UpdateUi(ExtendedLabel view, TextView control) { if (!string.IsNullOrEmpty(view.FontName)) { string filename = view.FontName; //if no extension given then assume and add .ttf if (filename.LastIndexOf(".", System.StringComparison.Ordinal) != filename.Length - 4) { filename = string.Format("{0}.ttf", filename); } control.Typeface = TrySetFont(filename); } //======= This is for backward compatability with obsolete attrbute 'FontNameAndroid' ======== if (!string.IsNullOrEmpty(view.FontNameAndroid)) { control.Typeface = TrySetFont(view.FontNameAndroid);; } //====== End of obsolete section ========================================================== if (view.FontSize > 0) { control.TextSize = (float)view.FontSize; } if (view.IsUnderline) { control.PaintFlags = control.PaintFlags | PaintFlags.UnderlineText; } if (view.IsStrikeThrough) { control.PaintFlags = control.PaintFlags | PaintFlags.StrikeThruText; } }
public ExtendedLabelPage() { InitializeComponent(); BindingContext = ViewModelLocator.Main; var label = new ExtendedLabel { Text = "and From code", FontName = Device.OnPlatform <String>("Roboto-Light", "fonts/Roboto-Light.ttf", "Courier New"), IsUnderline = true, FontSize = 22, }; var label2 = new ExtendedLabel { Text = "and From code", FontName = Device.OnPlatform <String>("Roboto-Light", "fonts/Roboto-Light.ttf", "Courier New"), IsUnderline = false, IsStrikeThrough = true, FontSize = 22, }; stkRoot.Children.Add(label); stkRoot.Children.Add(label2); }
protected void RptModelList1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { HtmlTableRow row = (HtmlTableRow)e.Item.FindControl("ModelTr"); if (this.m_ArrModelTr.Length == 0) { this.m_ArrModelTr.Append("\"" + row.ClientID + "\""); } else { this.m_ArrModelTr.Append(",\"" + row.ClientID + "\""); } if (e.Item.ItemIndex > 0) { row.Attributes.Add("class", "tdbg"); } else { row.Attributes.Add("class", "title"); } if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { ExtendedLabel label = (ExtendedLabel)e.Item.FindControl("modellist"); label.BeginTag = "<a href=\"javascript:Hidd(" + e.Item.ItemIndex.ToString() + ")\">"; label.Text = ((ModelInfo)e.Item.DataItem).ModelName; label.EndTag = "</a>"; } } }
private void SetPlaceholder(ExtendedLabel view) { if (view == null) { return; } if (view.FormattedText != null) { var asfd = view.FormattedText.ToAttributed(Font.Default, view.TextColor); this.Control.AttributedText = asfd; LayoutSubviews(); return; } if (!string.IsNullOrEmpty(view.Text)) { this.UpdateUi(view); LayoutSubviews(); return; } if (string.IsNullOrWhiteSpace(view.Placeholder) && view.FormattedPlaceholder == null) { return; } var formattedPlaceholder = view.FormattedPlaceholder ?? view.Placeholder; Control.AttributedText = formattedPlaceholder.ToAttributed(view.Font, view.TextColor); LayoutSubviews(); }
public ExtendedLabelPage() { InitializeComponent(); BindingContext = ViewModelLocator.Main; var label = new ExtendedLabel { Text = "From code, using Device.OnPlatform, Underlined", FontName = "Open 24 Display St.ttf", FriendlyFontName = Device.OnPlatform <String>("", "", "Open 24 Display St"), IsUnderline = true, FontSize = 22, }; var label2 = new ExtendedLabel { Text = "From code, Strikethrough", FontName = "Open 24 Display St.ttf", FriendlyFontName = Device.OnPlatform <String>("", "", "Open 24 Display St"), IsUnderline = false, IsStrikeThrough = true, FontSize = 22, }; stkRoot.Children.Add(label); stkRoot.Children.Add(label2); }
public ExtendedLabelPage() { InitializeComponent(); BindingContext = ViewModelLocator.Main; var label3 = new ExtendedLabel { Text = "From code, Strikethrough and using Font property", TextColor = Device.OnPlatform(Color.Black, Color.White, Color.White), IsUnderline = false, IsStrikeThrough = true }; var label4 = new ExtendedLabel { IsDropShadow = true, Text = "From code, Dropshadow with TextColor", TextColor = Color.Green }; var label5 = new Label { Text = "Standard Label created using code", }; stkRoot.Children.Add(label4); stkRoot.Children.Add(label3); stkRoot.Children.Add(label5); }
void UpdateUi(ExtendedLabel view, TextView control) { if (!string.IsNullOrEmpty(view.FontName)) { control.Typeface = TrySetFont(view.FontName); } if (!string.IsNullOrEmpty(view.FontNameAndroid)) { control.Typeface = TrySetFont(view.FontNameAndroid);; } if (view.FontSize > 0) { control.TextSize = (float)view.FontSize; } if (view.IsUnderline) { control.PaintFlags = control.PaintFlags | PaintFlags.UnderlineText; } if (view.IsStrikeThrough) { control.PaintFlags = control.PaintFlags | PaintFlags.StrikeThruText; } }
private void UpdateProperties(ExtendedLabel extendedLabel) { if (extendedLabel.MaxLines > 0d) { Control.SetSingleLine(false); Control.SetMaxLines(extendedLabel.MaxLines); } }
/// <summary> /// Updates the UI. /// </summary> /// <param name="view"> /// The view. /// </param> /// <param name="control"> /// The control. /// </param> private static void UpdateUi(ExtendedLabel view, UILabel control) { if (view.FontSize > 0) { control.Font = UIFont.FromName(control.Font.Name, (float)view.FontSize); } if (!string.IsNullOrEmpty(view.FontName)) { string fontName = view.FontName; //if extension given then remove it for iOS if (fontName.LastIndexOf(".", System.StringComparison.Ordinal) == fontName.Length - 4) { fontName = fontName.Substring(0, fontName.Length - 4); } var font = UIFont.FromName( fontName, control.Font.PointSize); if (font != null) { control.Font = font; } } //======= This is for backward compatability with obsolete attrbute 'FontNameIOS' ======== if (!string.IsNullOrEmpty(view.FontNameIOS)) { var font = UIFont.FromName( view.FontNameIOS, (view.FontSize > 0) ? (float)view.FontSize : 12.0f); if (font != null) { control.Font = font; } } //====== End of obsolete section ========================================================== var attrString = new NSMutableAttributedString(control.Text); if (view.IsUnderline) { //control.AttributedText = new NSAttributedString( // control.Text, // underlineStyle: NSUnderlineStyle.Single); attrString.AddAttribute(UIStringAttributeKey.UnderlineStyle, NSNumber.FromInt32((int)NSUnderlineStyle.Single), new NSRange(0, attrString.Length)); } if (view.IsStrikeThrough) { attrString.AddAttribute(UIStringAttributeKey.StrikethroughStyle, NSNumber.FromInt32((int)NSUnderlineStyle.Single), new NSRange(0, attrString.Length)); } control.AttributedText = attrString; }
public ExtendedLabelPage() { InitializeComponent(); BindingContext = ViewModelLocator.Main; var label = new ExtendedLabel { Text = "From code, using Device.OnPlatform, Underlined", FontName = "Open 24 Display St.ttf", FriendlyFontName = Device.OnPlatform("", "", "Open 24 Display St"), IsUnderline = true, FontSize = 22, }; var label2 = new ExtendedLabel { Text = "From code, Strikethrough", FontName = "Open 24 Display St.ttf", FriendlyFontName = Device.OnPlatform("", "", "Open 24 Display St"), IsUnderline = false, IsStrikeThrough = true, FontSize = 22, }; var font = Font.OfSize("Open 24 Display St", 22); var label3 = new ExtendedLabel { Text = "From code, Strikethrough and using Font property", TextColor = Device.OnPlatform(Color.Black, Color.White, Color.White), IsUnderline = false, IsStrikeThrough = true }; var label4 = new ExtendedLabel { IsDropShadow = true, DropShadowColor = Color.Red, Text = "From code, Dropshadow with TextColor", TextColor = Color.Green }; var label5 = new Label { Text = "Standard Label created using code", }; label3.Font = font; stkRoot.Children.Add(label4); stkRoot.Children.Add(label3); stkRoot.Children.Add(label2); stkRoot.Children.Add(label); stkRoot.Children.Add(label5); }
private void UpdateUi(ExtendedLabel extendedElement) { if (!string.IsNullOrEmpty(extendedElement.Text)) { var strikethrough = extendedElement.IsStrikeThrough ? NSUnderlineStyle.Single : NSUnderlineStyle.None; Control.AttributedText = new NSMutableAttributedString(extendedElement.Text, Control.Font, strikethroughStyle: strikethrough); LayoutSubviews(); } }
private void UserSpecialPermissions(GridViewRowEventArgs e) { SpecialTree dataItem = (SpecialTree)e.Row.DataItem; ExtendedLabel label = (ExtendedLabel)e.Row.FindControl("LabName"); CheckBox box = (CheckBox)e.Row.FindControl("ChkSpecialInput"); HiddenField field = (HiddenField)e.Row.FindControl("HdnSpecialId"); if (dataItem != null) { label.Text = dataItem.Name; label.BeginTag = Special.TreeLine(dataItem.TreeLineType); if (dataItem.Name == "所有专题") { label.BeginTag = label.BeginTag + "<span style='color:red'>"; label.EndTag = "</span>"; } if (dataItem.IsSpecialCategory) { field.Value = "0"; box.Visible = false; } else { field.Value = dataItem.Id.ToString(); } if (!dataItem.IsSpecialCategory) { if (dataItem.Id == -1) { this.m_inputSpecialId = box.ClientID; box.Attributes.Add("onclick", "ChkSpecialAll(this.form,'" + box.ID + "'," + this.m_inputSpecialId + ")"); } else { box.Attributes.Add("onclick", "ChkWipeOffSpecialAll(" + this.m_inputSpecialId + ")"); } foreach (RoleSpecialPermissionsInfo info in UserPermissions.GetSpecialPermissionsBySpecialId(dataItem.Id, this.m_IdType)) { if ((info.OperateCode == OperateCode.SpecialContentInput) && (info.GroupId == this.m_RoleId)) { if (dataItem.Id == -1) { this.m_inputSpecialAll = true; box.Checked = true; break; } if (!this.m_inputSpecialAll) { box.Checked = true; } } } } } }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); ExtendedLabel extendedLabel = (ExtendedLabel)Element; if (extendedLabel != null && extendedLabel.MaxLines != -1) { Control.Lines = extendedLabel.MaxLines; } }
private void UpdateUi(ExtendedLabel extendedElement) { if (extendedElement.IsStrikeThrough) { Control.PaintFlags = Control.PaintFlags | PaintFlags.StrikeThruText; } else { Control.PaintFlags = PaintFlagsOriginal; } }
private void UpdateProperties(ExtendedLabel extendedLabel) { if (!string.IsNullOrEmpty(extendedLabel.Text)) { if (extendedLabel.MaxLines > 0) { Control.Lines = extendedLabel.MaxLines; } LayoutSubviews(); } }
/// <summary> /// Simply moved the entire code block into it's own method to keep it more organized. /// Issue: /// VerticalTextAlignment.Start has Bottom assigned and End has Top is because in Xamarin it seems to be the other way around. /// Instead of pushing the object to the top of the container it pushes it to the bottom. /// </summary> private void SetTheControlGravity(ExtendedLabel element) { if (element.HorizontalTextAlignment == Xamarin.Forms.TextAlignment.Start && element.VerticalTextAlignment == Xamarin.Forms.TextAlignment.Start) { //Log.Warning("Alignment", "Left - Top"); Control.Gravity = GravityFlags.Left | GravityFlags.Bottom; } else if (element.HorizontalTextAlignment == Xamarin.Forms.TextAlignment.Start && element.VerticalTextAlignment == Xamarin.Forms.TextAlignment.End) { //Log.Warning("Alignment", "Left - Bottom"); Control.Gravity = GravityFlags.Left | GravityFlags.Top; } else if (element.HorizontalTextAlignment == Xamarin.Forms.TextAlignment.Start && element.VerticalTextAlignment == Xamarin.Forms.TextAlignment.Center) { //Log.Warning("Alignment", "Left - VCenter"); Control.Gravity = GravityFlags.Left | GravityFlags.CenterVertical; } else if (element.HorizontalTextAlignment == Xamarin.Forms.TextAlignment.End && element.VerticalTextAlignment == Xamarin.Forms.TextAlignment.Start) { //Log.Warning("Alignment", "Right - Top"); Control.Gravity = GravityFlags.Right | GravityFlags.Bottom; } else if (element.HorizontalTextAlignment == Xamarin.Forms.TextAlignment.End && element.VerticalTextAlignment == Xamarin.Forms.TextAlignment.End) { //Log.Warning("Alignment", "Right - Bottom"); Control.Gravity = GravityFlags.Right | GravityFlags.Top; } else if (element.HorizontalTextAlignment == Xamarin.Forms.TextAlignment.End && element.VerticalTextAlignment == Xamarin.Forms.TextAlignment.Center) { //Log.Warning("Alignment", "Right - VCenter"); Control.Gravity = GravityFlags.Right | GravityFlags.CenterVertical; } else if (element.HorizontalTextAlignment == Xamarin.Forms.TextAlignment.Center && element.VerticalTextAlignment == Xamarin.Forms.TextAlignment.Start) { //Log.Warning("Alignment", "HCenter - Top"); Control.Gravity = GravityFlags.CenterHorizontal | GravityFlags.Bottom; } else if (element.HorizontalTextAlignment == Xamarin.Forms.TextAlignment.Center && element.VerticalTextAlignment == Xamarin.Forms.TextAlignment.End) { //Log.Warning("Alignment", "HCenter - Bottom"); Control.Gravity = GravityFlags.CenterHorizontal | GravityFlags.Top; } else if (element.HorizontalTextAlignment == Xamarin.Forms.TextAlignment.Center && element.VerticalTextAlignment == Xamarin.Forms.TextAlignment.Center) { //Log.Warning("Alignment", "HCenter - VCenter"); Control.Gravity = GravityFlags.CenterHorizontal | GravityFlags.CenterVertical; } else { //Log.Warning("Alignment", "Center"); Control.Gravity = GravityFlags.Center; } }
protected void EgvNodes_RowDataBound(object sender, GridViewRowEventArgs e) { NodeInfo nodeInfo = new NodeInfo(); nodeInfo = (NodeInfo)e.Row.DataItem; if (e.Row.RowType == DataControlRowType.DataRow) { ExtendedLabel label = (ExtendedLabel)e.Row.FindControl("LabNodeShowTree"); label.BeginTag = Nodes.GetTreeLine(nodeInfo.Depth, nodeInfo.ParentPath, nodeInfo.NextId, nodeInfo.Child); label.EndTag = Nodes.GetNodeDir(nodeInfo.Child, nodeInfo.NodeType, nodeInfo.NodeDir); if (nodeInfo.NodeName == "所有栏目") { label.BeginTag = label.BeginTag + "<span style='color:red'>"; label.EndTag = "</span>" + label.EndTag; } label.Text = nodeInfo.NodeName; string permissionsType = this.m_PermissionsType; if (permissionsType != null) { if (!(permissionsType == "Role")) { if (permissionsType == "User") { this.UserNodeContentSelectPermission(e, nodeInfo); } } else { string type = this.m_Type; if (type != null) { if (!(type == "Content")) { if (!(type == "Comment")) { if (type == "Node") { this.NodeSelectPermission(e, nodeInfo); } return; } } else { this.NodeContentSelectPermission(e, nodeInfo); return; } this.NodeCommentSelectPermission(e, nodeInfo); } } } } }
private static void UpdateUi(ExtendedLabel view, TextView control) { if (view.FontSize > 0) { control.TextSize = (float)view.FontSize; } if (view.IsUnderlined) { control.PaintFlags = control.PaintFlags | PaintFlags.UnderlineText; } }
protected override void OnElementChanged(ElementChangedEventArgs <Label> e) { base.OnElementChanged(e); ExtendedLabel extendedLabel = (ExtendedLabel)Element; if (extendedLabel != null && extendedLabel.MaxLines != -1) { Control.SetSingleLine(false); Control.SetMaxLines(extendedLabel.MaxLines); } }
private static void UpdateUi(ExtendedLabel view, UILabel control) { var attrString = new NSMutableAttributedString(control.Text); if (view.IsUnderlined) { attrString.AddAttribute(UIStringAttributeKey.UnderlineStyle, NSNumber.FromInt32((int)NSUnderlineStyle.Single), new NSRange(0, attrString.Length)); } control.AttributedText = attrString; }
public ExtendedLabelPage() { InitializeComponent(); BindingContext = ViewModelLocator.Main; var label = new ExtendedLabel() { Text = "and From code", }; label.FontName = Device.OnPlatform <String>("Roboto-Light", "fonts/Roboto-Light.ttf", ""); label.FontSize = 22; stkRoot.Children.Add(label); }
void UpdateUi(ExtendedLabel view, TextView control) { if (!string.IsNullOrEmpty(view.FontName)) { control.Typeface = TrySetFont(view.FontName); } if (!string.IsNullOrEmpty(view.FontNameAndroid)) { control.Typeface = TrySetFont(view.FontNameAndroid);; } if (view.FontSize > 0) { control.TextSize = (float)view.FontSize; } }
void PlanStructure_Resized(object sender, EventArgs args) { LabelPlus.Location = new Point(PlanStructure.Columns[0].Width - 30, LabelPlus.Location.Y); DateRange.Width = LabelPlus.Location.X + 1 - DateRange.Location.X; ScheduleSlider.Location = new Point(MainSplit.Panel1.Width - PlanStructure.Columns[1].Width, ScheduleSlider.Location.Y); ScheduleSlider.Width = PlanStructure.Columns[1].Width; ExtendedLabel.Location = new Point(ScheduleSlider.Location.X, ExtendedLabel.Location.Y); ExtendedLabel.Width = ScheduleSlider.Width; ExtendedLabel.Update(); LabelPlus.Update(); }
/// <summary> /// Creates the entity label. /// </summary> /// <returns>The entity label.</returns> /// <param name="manager">Manager.</param> /// <param name="entity">Entity.</param> /// <param name="entityFormat">Entity format.</param> /// <typeparam name="T">The 1st type parameter.</typeparam> public ExtendedLabel CreateEntityLabel <T>(NexusManager <T> manager, EntityBase entity, string entityFormat = "{0}") where T : EntityBase, new() { ExtendedLabel entityLabel = new ExtendedLabel { Text = string.Format(entityFormat, entity.ToString()), TextColor = Color.Blue, IsUnderline = true }; TapGestureRecognizer tapGesture = new TapGestureRecognizer(); tapGesture.Command = new Command((e) => { EntityPageBuilderFactory.ShowEntityPage <T>(manager, entity.Id); }); entityLabel.GestureRecognizers.Add(tapGesture); return(entityLabel); }
private void SetFont(ExtendedLabel label) { if (!String.IsNullOrWhiteSpace(label.FontName)) { var font = UIFont.FromName(label.FontName, (nfloat)label.FontSize); if (font != null) { this.Control.Font = font; } } else { var tmp = Font.Default.ToUIFont().WithSize((nfloat)label.FontSize); this.Control.Font = Font.Default.ToUIFont().WithSize((nfloat)label.FontSize); } }
/// <summary> /// Adds the heading. /// </summary> /// <param name="heading">Heading.</param> public ExtendedLabel AddHeading(string heading) { if (heading == null || PageLayout == null) { return(null); } ExtendedLabel label = new ExtendedLabel { HorizontalOptions = LayoutOptions.CenterAndExpand, FontAttributes = FontAttributes.Bold, Text = heading, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), IsUnderline = true }; PageLayout.Children.Add(label); return(label); }
public Skills() { Orientation = StackOrientation.Horizontal; VerticalOptions = LayoutOptions.FillAndExpand; HorizontalOptions = LayoutOptions.FillAndExpand; Spacing = 5; _loadingLabel = new ExtendedLabel { Text = "loading...", FontSize = 12, HorizontalTextAlignment = TextAlignment.Center, TextColor = (Color)Application.Current.Resources["Accent"] }; Children.Add(_loadingLabel); }
public ExtendedLabelPage() { InitializeComponent(); var label = new ExtendedLabel() { Text = "and From code", }; label.FontName = Device.OnPlatform <String>("Roboto-Light", "fonts/Roboto-Light.ttf", ""); stkRoot.Children.Add(label); var section = new TableSection() { new ExtendedTextCell { Text = "Sessions", FontName = Device.OnPlatform <String>("Roboto-Light", "fonts/Roboto-Light.ttf", "") }, new ExtendedTextCell { Text = "Speakers", FontName = Device.OnPlatform <String>("Roboto-Light", "fonts/Roboto-Light.ttf", "") }, new ExtendedTextCell { Text = "Favorites", FontName = Device.OnPlatform <String>("Roboto-Light", "fonts/Roboto-Light.ttf", "") }, new ExtendedTextCell { Text = "Room Plan", FontName = Device.OnPlatform <String>("Roboto-Light", "fonts/Roboto-Light.ttf", "") }, new ExtendedTextCell { Text = "Map", FontName = Device.OnPlatform <String>("Roboto-Light", "fonts/Roboto-Light.ttf", "") }, new ExtendedTextCell { Text = "About", FontName = Device.OnPlatform <String>("Roboto-Light", "fonts/Roboto-Light.ttf", "") }, }; var root = new TableRoot() { section }; var tableView = new TableView() { Root = root, Intent = TableIntent.Menu, }; stkRoot.Children.Add(tableView); this.BindingContext = ViewModelLocator.Main; }
public void SetTitle(Gtk.Widget page, Gdk.Pixbuf icon, string label) { this.label = label; this.page = page; if (Child != null) { Gtk.Widget oc = Child; // keep a handle to the Child widget to prevent it from being garbage collected Remove(oc); // remove Child from parent. After this, Child==null oc.Destroy(); // now that no reference from the parent points to the child anymore, destroy it. //oc.Dispose(); // not sure if this is additionally needed to .Destroy() } Gtk.HBox box = new HBox(); box.Spacing = 2; if (icon != null) { tabIcon = new Gtk.Image(icon); tabIcon.Show(); box.PackStart(tabIcon, false, false, 0); } else tabIcon = null; if (!string.IsNullOrEmpty(label)) { labelWidget = new ExtendedLabel(label); labelWidget.DropShadowVisible = true; labelWidget.UseMarkup = true; box.PackStart(labelWidget, true, true, 0); } else { labelWidget = null; } btnDock = new ImageButton(); btnDock.Image = pixAutoHide; btnDock.TooltipText = "Minimize"; // previous text "Auto Hide" was misleading btnDock.CanFocus = false; // btnDock.WidthRequest = btnDock.HeightRequest = 17; btnDock.Clicked += OnClickDock; btnDock.ButtonPressEvent += (o, args) => args.RetVal = true; btnDock.WidthRequest = btnDock.SizeRequest().Width; btnClose = new ImageButton(); btnClose.Image = pixClose; btnClose.TooltipText = "Close"; btnClose.CanFocus = false; btnClose.WidthRequest = btnDock.SizeRequest().Width; btnClose.Clicked += delegate { item.Close(); }; btnClose.ButtonPressEvent += (o, args) => args.RetVal = true; Gtk.Alignment al = new Alignment(0, 0, 1, 1); HBox btnBox = new HBox(false, 3); btnBox.PackStart(btnDock, false, false, 0); btnBox.PackStart(btnClose, false, false, 0); al.Add(btnBox); al.LeftPadding = 3; al.TopPadding = 1; box.PackEnd(al, false, false, 0); Add(box); // Get the required size before setting the ellipsize property, since ellipsized labels // have a width request of 0 box.ShowAll(); Show(); UpdateBehavior(); UpdateVisualStyle(); }