Hi
Found a funny behavior in the RadCommandbar.
Just try this:
In attachment I created a small movie clip that illustrates this behavior.
Kind regards,
Peter.
I set the ShowClearButton on the design-time but the clear button not displayed when I run the application.
However, it works fun when I set the ShowClearButton programatically.
commandBarTextBox1.TextBoxElement.ShowClearButton = true;
Do you know why?
Please refer to the attached gif file and the provided sample project.
//Workaround 1 this.commandBarDropDownList1.CommandBarDropDownListElement.EditableElement.TextBox.TextBoxItem.UseDefaultDisabledPaint = false;
this.commandBarDropDownList1.CommandBarDropDownListElement.EditableElement.TextBox.TextBoxItem.Enabled = false;
//Workaround 2
private void CommandBarDropDownList1_SelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
this.commandBarDropDownList1.CommandBarDropDownListElement.EditableElement.TextBox.TextBoxItem.SelectionLength = 0;
this.commandBarDropDownList1.CommandBarDropDownListElement.EditableElement.TextBox.TextBoxItem.SelectionStart = 0;
}
private void TextBoxItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
this.commandBarDropDownList1.CommandBarDropDownListElement.EditableElement.TextBox.TextBoxItem.SelectionLength = 0;
this.commandBarDropDownList1.CommandBarDropDownListElement.EditableElement.TextBox.TextBoxItem.SelectionStart = 0;
}
To reproduce: 1. Create a project 2. Add a Telerik form 3. Add a RadCommandBar 4. Add some buttons 5. Debug application (forget you are running application) 6. Click on add button on command bar. As a result, Visual studio Crashes. Note: if you perform the same steps with RadRibbonBar a message is shown that the file can't be modified while debugging. Please refer to the attached screenshot.
Use attached to reproduce.
Workaround: set the RadCommandBar.EnableRadAccessibilityObjects property to false.
Workaround: use the attached below theme files. How custom themes can be loaded - http://www.telerik.com/help/winforms/themes-using-custom-themes.html
Workaround: public partial class RadForm1 : Telerik.WinControls.UI.RadForm { public RadForm1() { InitializeComponent(); this.commandBarDropDownButton2.DropDownMenu.DropDownOpening += DropDownMenu_DropDownOpening; } private void DropDownMenu_DropDownOpening(object sender, CancelEventArgs e) { if (this.WindowState == FormWindowState.Maximized) { RadDropDownMenu dMenu = sender as RadDropDownMenu; RadPopupOpeningEventArgs eventArgs = (RadPopupOpeningEventArgs)e; eventArgs.CustomLocation = new System.Drawing.Point(eventArgs.CustomLocation.X + this.commandBarDropDownButton2.Size.Width, eventArgs.CustomLocation.Y); } } }
To reproduce: add a RadCommandBar to the form with several CommandBarStripElements. Change the Name property for one of the CommandBarStripElements at design time. You will notice that the new name is not serialized in the designer file.
To reproduce: Add a RadCommandBar with a row and a strip. Add a CommandBarSplitButton and subscribe to its Click event. You will see that when you click the arrow button the event will be fired. In result you cannot distinguish whether the arrow button is clicked. Workaround: private bool arrowButtonClicked; void ArrowPart_Click(object sender, EventArgs e) { this.arrowButtonClicked = true; //... CommandBarSplitButton.ArrowPart logic } void button_Click(object sender, EventArgs e) { if (this.arrowButtonClicked) { this.arrowButtonClicked = false; return; } //...CommandBarSplitButton logic }
To reproduce: Add a RadCommandBar, add some rows, strips and buttons. Apply any of the following themes: Office2010Black, Office2010Blue or VisualStudio2012Light . You will notice that the whole RadCommandBar has no theming. Workaround: Download the theme files below and apply them as follows: ThemeResolutionService.LoadPackageFile(@"themPath/theme.tssp"); ThemeResolutionService.ApplicationThemeName = "VisualStudio2012Light";
Since the IsChecked property is obsolete one cannot use simple data binding to bind the control.
Workaround: use the following approach: private void commandBarDropDownList1_EnabledChanged(object sender, EventArgs e) { if (this.commandBarDropDownList1.Enabled) { this.commandBarDropDownList1.DropDownListElement.TextBox.BackColor = Color.White; } else { this.commandBarDropDownList1.DropDownListElement.TextBox.TextBoxItem.BackColor = Color.FromArgb(210, 210, 210); } }
When you change the ImageList property of RadCommandBar at runtime, the images of the items are not updated. In addition, if there are items in the overflow popup, their image is reset to default. WORKAROUND: You need to reset each item's ImageIndex property in order for the new image to appear and you also need to update the ImageList property of the overflow popups manually. private void radCheckBox1_ToggleStateChanged(object sender, StateChangedEventArgs args) { radCommandBar1.ImageList = radCheckBox1.Checked ? imageList32 : imageList16; ToggleImageIndices(); } private void ToggleImageIndices() { foreach (var row in radCommandBar1.Rows) { foreach (var strip in row.Strips) { ((RadControl)strip.OverflowButton.OverflowPanel.Layout.ElementTree.Control).ImageList = radCommandBar1.ImageList; foreach (var item in strip.Items) { int oldIndex = item.ImageIndex; item.ImageIndex = -1; item.ImageIndex = oldIndex; } foreach (var item in strip.OverflowButton.OverflowPanel.Layout.Children.OfType<RadCommandBarBaseItem>()) { int oldIndex = item.ImageIndex; item.ImageIndex = -1; item.ImageIndex = oldIndex; } } } }
Description: add a RadCommandBar and Dock it to the Left. Add several CommandBarToggleButton and CommandBarButton items and set their StretchHorizontally property to true and StretchVertically property to false. Save changes, close the designer and open it again. The settings are not kept.
To reproduce: radCommandBar1.Dock = DockStyle.Left; CommandBarToggleButton toggleButton = new CommandBarToggleButton(); toggleButton.Text = "some text"; toggleButton.Orientation = Orientation.Vertical; toggleButton.DrawText = true; radCommandBar1.Rows[0].Strips[0].Items.Add(toggleButton); radCommandBar1.Rows[0].Strips[0].Orientation = Orientation.Vertical;
FIX. RadCommandBar - selecting default item for CommandBarSplitButton prevents the drop down from being opened
PopUpOpened event does not fire then the CommandBarDropDownList is created runtime.
To reproduce: - add command bar to a form and dock it top - add button below the command bar and dock it fill - click the command bar and try to open the Rows collection editor from the properties window
To reproduce: -add CommandBarDropDownButton and add several items of type RadMenuButtonItem; -use the following code: this.commandBarDropDownButton1.DropDownMenu.DropDownClosed += DropDownMenu_DropDownClosed; private void DropDownMenu_DropDownClosed(object sender, Telerik.WinControls.UI.RadPopupClosedEventArgs args) { RadDropDownMenu dropDownMenu = sender as RadDropDownMenu; if (dropDownMenu != null) { CommandBarDropDownButton commandBarDropDownButton = dropDownMenu.Owner as CommandBarDropDownButton; commandBarDropDownButton.Text = dropDownMenu.ClickedItem.Text.ToString(); } } ClickedItem is null only in case of RadMenuButtonItem. Workaround: public class CustomCommandBarDropDownButton : CommandBarDropDownButton { protected override void CreateChildElements() { base.CreateChildElements(); this.DropDownMenu = new CustomDropDownMenu(this); } protected override Type ThemeEffectiveType { get { return typeof(CommandBarDropDownButton); } } } public class CustomDropDownMenu : RadDropDownMenu { public CustomDropDownMenu(RadElement ownerElement) : base(ownerElement, null) { } public override string ThemeClassName { get { return typeof(RadDropDownMenu).FullName; } } protected override void OnMouseClick(MouseEventArgs e) { RadMenuItemBase menuItem = this.GetMenuItemAtPoint(e.Location); if (menuItem is RadMenuButtonItem) { FieldInfo field = typeof(RadDropDownMenu).GetField("clickedItem", BindingFlags.NonPublic | BindingFlags.Instance); field.SetValue(this, menuItem); } base.OnMouseClick(e); } }