Remove "Add or Remove Buttons" in Rad Command Bar - winforms

I have a Rad Command Bar created with the code below:
RadCommandBar main = new RadCommandBar();
main.Dock = DockStyle.Top;
main.AutoSize = true;
main.Size = new System.Drawing.Size(874, 59);
CommandBarRowElement address = new CommandBarRowElement();
CommandBarStripElement strip = new CommandBarStripElement();
strip.FloatingForm = null;
strip.StretchHorizontally = true;
address.Strips.Add(strip);
CommandBarDropDownList addressEdit = new CommandBarDropDownList();
addressEdit.MaxSize = new System.Drawing.Size(0, 0);
addressEdit.VisibleInOverflowMenu = true;
addressEdit.StretchHorizontally = true;
main.Rows.Add(address);
parent.Controls.Add(main);
I'm having issue with hiding the "Add or Remove Buttons" of the strip element. Can someone point me to the right way to hide that menu?

You can use the following code:
strip.OverflowButton.Visibility = Telerik.WinControls.ElementVisibility.Hidden;

It it better to set the Visibility to Collapsed, in order to collapse the whole item. Using Hidden will hide the item, but its space will be retained. More information is available here: Customize the overflow button

Related

Windows Form Label position issue

I have a UserControl which has a Label at the bottom right corner defined as followed:
this.lblInspectionName.AutoSize = true;
this.lblInspectionName.Font = new System.Drawing.Font("Segoe UI", 10.25F, System.Drawing.FontStyle.Bold);
this.lblInspectionName.Location = new System.Drawing.Point(3, 7);
this.lblInspectionName.Name = "lblInspectionName";
this.lblInspectionName.Size = new System.Drawing.Size(113, 19);
this.lblInspectionName.TabIndex = 0;
this.lblInspectionName.Text = "___";
Its Text content changes based on other events. The problem is that when the Label gets bigger, it goes to left (as I want otherwise it exceeds the right border), but when it gets smaller again the location is the same as the previous case and it's positioned too left.
Do you know how I can let the label grows to left when necessary keeping always a certain distance/margin to the right border? Thanks in advance!
EDIT
Doing as suggested, the situation is the following:
I would add these properties settings
this.lblInspectionName.Dock = DockStyle.Bottom;
this.lblInspectionName.TextAlign = ContentAlignment.BottomRight;
But you need to set the AutoSize back to false.
// Comment out this line. False is default
// this.lblInspectionName.AutoSize = true;

Add Dynamic Check Box in Grid Takes Time in Silverlight

I Have a Grid (BrkGrid) in ViewMode... I Add dynamic Check Box (brkChkBox) depending on some logic. A foreach is responsible for adding check boxes to a specific row and column of this grid.. But it takes time while adding check boxes to the BrkGrid.. When I Comment the Add Statement (BrkGrid.Children.Add(brkChkBox)) then the code executes faster.. Any help will be highly appreciated...
CheckBox brkChkBox = null;
foreach (var s in this.ViewData.PlnDtShiftBrksDateList)
{
brkChkBox = new CheckBox
{
DataContext = s,
Tag = s.BreakID,
Width = 20,
VerticalAlignment = VerticalAlignment.Top,
};
Binding chkBoxBinding = new Binding("IsSelected");
chkBoxBinding.Source = s;
chkBoxBinding.Mode = BindingMode.TwoWay;
brkChkBox.SetBinding(CheckBox.IsCheckedProperty, chkBoxBinding);
brkChkBox.Click += brkChkBox_Click;
Grid.SetColumn(brkChkBox, gridColDic.FirstOrDefault(x => x.Key == s.BreakID).Value);
Grid.SetRow(brkChkBox, gridRowDic.FirstOrDefault(x => x.Key.Date == s.Date.Date).Value);
BrkGrid.Children.Add(brkChkBox);
}

telerik listcontrol only shows part of item image

I am filling a listcontrol (Telerik for WinForms) by using the following code :
public static List<RadListDataItem> GetItems()
{
List<RadListDataItem> items = new List<RadListDataItem>();
for (int i = 1; i <= 10; i++)
{
RadListDataItem toadd = new RadListDataItem();
toadd.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
toadd.Text = "sssssssssss";
//toadd.Image.
string imagename = "MyProject.SuIcons.d" + i + ".JPG";
toadd.Image = new Bitmap(Assembly.GetExecutingAssembly().
GetManifestResourceStream(imagename));
items.Add(toadd);
}
return items;
}
but, only top portition of every item image is show in listcontrol, I mean I cant see the whole image associated with item in the list.
Would you help me please ?
You should set the AutoSizeItems property of the control to true in order to allow the visual items size themselves according to their content:
radListControl1.AutoSizeItems = true;
You can adjust the item size of the radListView. There is a property ItemSize that you can change in the designer view. Or if you want to do it programmatically, you can do something like this.
radListView1.ItemSize = new System.Drawing.Size(200, 400);
The first parameter is the width and the second is the height.

Add a hyperlink column for a Winforms DataGrid control

How can I add a hyperlink column for a Winforms DataGrid control?
Right now I am adding a string column like this
DataColumn dtCol = new DataColumn();
dtCol.DataType = System.Type.GetType("System.String");
dtCol.ColumnName = columnName;
dtCol.ReadOnly = true;
dtCol.Unique = false;
dataTable.Columns.Add(dtCol);
I just need it to be a hyperlink instead of a String. I am using C# with framework 3.5
Use a DataGridViewLinkColumn.
The link shows an example of setting up the column and adding it to a DGV::
DataGridViewLinkColumn links = new DataGridViewLinkColumn();
links.UseColumnTextForLinkValue = true;
links.HeaderText = ColumnName.ReportsTo.ToString();
links.DataPropertyName = ColumnName.ReportsTo.ToString();
links.ActiveLinkColor = Color.White;
links.LinkBehavior = LinkBehavior.SystemDefault;
links.LinkColor = Color.Blue;
links.TrackVisitedState = true;
links.VisitedLinkColor = Color.YellowGreen;
DataGridView1.Columns.Add(links);
You'll probably be interested in this example that shows how the snippet above fits into a more complete example of configuring DGV columns at runtime.

Windows forms: PropertyGrid

Does setting PropertyGrid.SelectedObject = null; effects the actual object?
eg:
Button b = new Button();
System.Windows.Forms.PropertyGrid pg = new System.Windows.Forms.PropertyGrid();
pg.SelectedObject = b;
pg.SelectedObject = null;
What will happen to Button b? will it be null?
Thanks & regards,
Vishal.
Setting PropertyGrid.SelectedObject only affects the PropertyGrid. If you set SelectedObject to null, it means that there is simply no object displayed in the property grid. In your example, button b will not be affected.

Resources