Telerik Forums
UI for WinForms Forum
1 answer
552 views
Hi,

I have an RadDropDownList filled with some items using DataSource and bounded functionality.
When I in the SelectedIndexChanged event tries to reset the selectedvalue to the original (the one before i changed), the control simply wont listen to my commands ;) 

This is the code I use in the SelectedIndexChanged event:
void AgreementRadDropDownSelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
{
    if (_init || _selectedAgreement == (int)AgreementRadDropDown.SelectedValue) return;
 
    if (MessageBox.Show("Do you want to change the agreement?", "Change Agreement", MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.No)
    {
        AgreementRadDropDown.SelectedValue = _selectedAgreement;
        return;
    }
    _selectedAgreement = (int)AgreementRadDropDown.SelectedValue;
}

The rest of the code of the form is here:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Telerik.WinControls.UI;
 
namespace TestDropDownList
{
    public partial class Form1 : Form
    {
        private readonly IList<Agreement> _agreements = new List<Agreement>();
        private int _selectedAgreement;
        private readonly bool _init = false;
 
        public Form1()
        {
            _init = true;
            InitializeComponent();
            AgreementRadDropDown.ItemDataBound += AgreementRadDropDownItemDataBound;
            AgreementRadDropDown.SelectedIndexChanged += AgreementRadDropDownSelectedIndexChanged;
            LoadAgreements();
            _selectedAgreement = 2;
 
            AgreementRadDropDown.SuspendUpdate();
            AgreementRadDropDown.DisplayMember = "Name";
            AgreementRadDropDown.ValueMember = "Id";
            AgreementRadDropDown.DataSource = _agreements;
 
            AgreementRadDropDown.SelectedValue = _selectedAgreement;
            AgreementRadDropDown.ResumeUpdate();
            _init = false;
        }
 
        void AgreementRadDropDownSelectedIndexChanged(object sender, Telerik.WinControls.UI.Data.PositionChangedEventArgs e)
        {
            if (_init || _selectedAgreement == (int)AgreementRadDropDown.SelectedValue) return;
 
            if (MessageBox.Show("Do you want to change the agreement?", "Change Agreement", MessageBoxButtons.YesNo,MessageBoxIcon.Question) == DialogResult.No)
            {
                AgreementRadDropDown.SelectedValue = _selectedAgreement;
                return;
            }
            _selectedAgreement = (int)AgreementRadDropDown.SelectedValue;
        }
 
        private void LoadAgreements()
        {
            _agreements.Add(new Agreement(1, "Agreement1", Properties.Resources._lock));
            _agreements.Add(new Agreement(2, "Agreement2", Properties.Resources._lock));
            _agreements.Add(new Agreement(3, "Agreement3", Properties.Resources.lock_unlock));
            _agreements.Add(new Agreement(4, "Agreement4", Properties.Resources._lock));
            _agreements.Add(new Agreement(5, "Agreement5", Properties.Resources.lock_unlock));
            _agreements.Add(new Agreement(6, "Agreement6", Properties.Resources._lock));
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
             
        }
 
        static void AgreementRadDropDownItemDataBound(object sender, ListItemDataBoundEventArgs args)
        {
            var item = args.NewItem.DataBoundItem as Agreement;
            if (item != null)
                args.NewItem.Image = item.StatusImage;
        }
    }
 
    public class Agreement
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public Image StatusImage { get; set; }
 
        public Agreement(int id, string name, Image statusImage)
        {
            Id = id;
            Name = name;
            StatusImage = statusImage;
        }
    }
}
namespace TestDropDownList
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.AgreementRadDropDown = new Telerik.WinControls.UI.RadDropDownList();
            ((System.ComponentModel.ISupportInitialize)(this.AgreementRadDropDown)).BeginInit();
            this.SuspendLayout();
            //
            // AgreementRadDropDown
            //
            this.AgreementRadDropDown.DropDownAnimationEnabled = true;
            this.AgreementRadDropDown.Location = new System.Drawing.Point(48, 37);
            this.AgreementRadDropDown.Name = "AgreementRadDropDown";
            this.AgreementRadDropDown.ShowImageInEditorArea = true;
            this.AgreementRadDropDown.Size = new System.Drawing.Size(222, 20);
            this.AgreementRadDropDown.TabIndex = 0;
            this.AgreementRadDropDown.Text = "radDropDownList1";
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(318, 167);
            this.Controls.Add(this.AgreementRadDropDown);
            this.Name = "Form1";
            this.Text = "Form1";
            this.Load += new System.EventHandler(this.Form1_Load);
            ((System.ComponentModel.ISupportInitialize)(this.AgreementRadDropDown)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
 
        }
 
        #endregion
 
        private Telerik.WinControls.UI.RadDropDownList AgreementRadDropDown;
    }
}


I use two images in my project.. they are attached here and need to be added to the resource file of the project to make this look like the one i have here :)

What am i doing wrong?

Regards
Svein Thomas
Peter
Telerik team
 answered on 17 Apr 2012
1 answer
139 views
Hi, I have a wizard running as part of a custom add-in for Outlook 2010. In one of the wizard dialogs I have a Telerik GridView control. The wizard dialog window that contains the Grid is re-sizable and I would like to have the Telerik Grid dynamically resize as the user re-sizes the Wizard dialog.

Any suggestions on how to achieve this would be greatly appreciated.

Thanks
Gary
Stefan
Telerik team
 answered on 17 Apr 2012
2 answers
127 views
Hi all,

I have a RadStatusStrip control, with inside 10 RadImageButtonElement controls (named BC0, BC1,BC2,BC3 etc) and a array with images (named Img())

How can I change the images of the RadImageButtonElement in a loop ?

Something this :

For I as Integer = 0 to 9 
      BC+i.tostring .image=img(i)
next I

I tryed to use :
    me.controls("BC"&i.tostring).image=img(i)   but it don't work !

Thanks

Stefan
Telerik team
 answered on 17 Apr 2012
1 answer
205 views
When I run the clickonce on the client computer, I am getting the following error in the error log:

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of \\snapshot\Deploy\ABC.application resulted in exception. Following failure messages were detected:
+ Reference in the manifest does not match the identity of the downloaded assembly Telerik.WinControls.dll.

I have set my references to copy local, and put Include in the application files section of Click Once. What am I doing wrong?  btw, I am a trial user and hoping to purchase soon.

Thanks
Stefan
Telerik team
 answered on 16 Apr 2012
1 answer
94 views
Hi,
Congrats on your lovely gridview control.
That is exactly what many people needed and i'm sure that you will continuing with many new features.
In my view it will be great to implement the full combobox functionality  on the gridview column. I mean the filtering and autocomplete functionality as well. May be there is a way but i can not find it, so please let me know.
Regards,
Simeon
Stefan
Telerik team
 answered on 16 Apr 2012
2 answers
128 views
I don't know why you can allow such a strange behavior of RadGridView to be existed for so long.
Initally, after data-binding, the first row will be selected, that's fine, some row has to be selected anyway, however, in this case, it IS NOT highlighted? Don't you think that it may confuse user? ("What the hell these data come from, I didn't select anything, it didn't say that I select anything, what's going on?")

I would like to have solution for it: Either disable first row select after data-binding (I didn't see any "SelectedIndex" so that I can set it to -1), or have the first row be highlighted as it is selected.

Thanks

Lamk.
Stefan
Telerik team
 answered on 16 Apr 2012
1 answer
164 views
Hi
I used radDateTimePicker , when i change the value of raddatetimepicker
, valuechanged method not called.
How i can resolved the problem.
Farshid
Top achievements
Rank 1
 answered on 14 Apr 2012
2 answers
81 views
Hi
How To RightToLeft RadAlarmForm when Shown Appointment Alarm?
Farshid
Top achievements
Rank 1
 answered on 14 Apr 2012
1 answer
381 views
Hi,

I'm trying to change the border color on a RadTextBox.
It should be easy using the control, but in my case the radtextbox is stored in a var.
Here a sample

 

Dim controle As String = CType(sender, RadTextBox).Name
 ' Change the text : It works !
Controls(controle).Text = "Hello, World"
 ' Change the border = DON'T WORK
DirectCast(Me.Controls(controle).TextBoxElement.Children(2), Telerik.WinControls.Primitives.BorderPrimitive).ForeColor = Color.Red

 


So I can change the text, but I have a problem with this line (.textBoxElement) not present :

DirectCast

 

 

Me.controls(controle).TextBoxElement.Children(2), Telerik.WinControls.Primitives.BorderPrimitive).ForeColor = Color.Red

Thanks for your help

Stefan
Telerik team
 answered on 13 Apr 2012
1 answer
119 views
I closed a couple of document windows in my Dock to free up space to work in visual studio.
I assumed that those windows would not have been permanently deleted, but they appear
to be gone.  When I re-enter the advanced designer, I no longer see them.

Is there a way to recover or restore those document windows I had closed in the advanced
designer of the Dock?
Stefan
Telerik team
 answered on 13 Apr 2012
Narrow your results
Selected tags
Tags
GridView
General Discussions
Scheduler and Reminder
Treeview
Dock
RibbonBar
Themes and Visual Style Builder
ChartView
Calendar, DateTimePicker, TimePicker and Clock
DropDownList
Buttons, RadioButton, CheckBox, etc
ListView
ComboBox and ListBox (obsolete as of Q2 2010)
Chart (obsolete as of Q1 2013)
Form
PageView
MultiColumn ComboBox
TextBox
RichTextEditor
PropertyGrid
Menu
RichTextBox (obsolete as of Q3 2014 SP1)
Panelbar (obsolete as of Q2 2010)
PivotGrid and PivotFieldList
Tabstrip (obsolete as of Q2 2010)
MaskedEditBox
CommandBar
PdfViewer and PdfViewerNavigator
ListControl
Carousel
Diagram, DiagramRibbonBar, DiagramToolBox
GanttView
Panorama
New Product Suggestions
Toolstrip (obsolete as of Q3 2010)
VirtualGrid
AutoCompleteBox
Label
Spreadsheet
ContextMenu
Panel
Visual Studio Extensions
TitleBar
Documentation
SplitContainer
Map
DesktopAlert
ProgressBar
CheckedDropDownList
TrackBar
MessageBox
Rotator
SpinEditor
StatusStrip
CheckedListBox
LayoutControl
SyntaxEditor
Wizard
ShapedForm
TextBoxControl
Conversational UI, Chat
DateTimePicker
CollapsiblePanel
TabbedForm
CAB Enabling Kit
GroupBox
DataEntry
ScrollablePanel
ScrollBar
WaitingBar
ImageEditor
Tools - VSB, Control Spy, Shape Editor
BrowseEditor
DataFilter
ColorDialog
FileDialogs
Gauges (RadialGauge, LinearGauge, BulletGraph)
ApplicationMenu
RangeSelector
CardView
WebCam
BindingNavigator
PopupEditor
RibbonForm
Styling
TaskBoard
Barcode
Callout
ColorBox
PictureBox
FilterView
Accessibility
VirtualKeyboard
NavigationView
DataLayout
ToastNotificationManager
ValidationProvider
CalculatorDropDown
Localization
TimePicker
ButtonTextBox
FontDropDownList
Licensing
BarcodeView
BreadCrumb
Security
LocalizationProvider
Dictionary
Overlay
Flyout
Separator
SparkLine
TreeMap
StepProgressBar
SplashScreen
ToolbarForm
NotifyIcon
DateOnlyPicker
Rating
TimeSpanPicker
Calculator
OfficeNavigationBar
TaskbarButton
HeatMap
SlideView
PipsPager
AIPrompt
TaskDialog
TimeOnlyPicker
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?