Telerik Forums
UI for WinForms Forum
2 answers
187 views

This must be simple, but I have trouble to get this solved ...

I have a mouse click event proc of which the sender type is a RadTextBoxItem. I need to know the textbox, so type TextBox or RadTextBox. How can this be done?

Marcus
Top achievements
Rank 1
 answered on 19 Mar 2012
3 answers
187 views
Hi,

I use the CommandBar with two CommandBarDropDownList items and I attach the SelectedIndexChanged event.
In the event handler I want to cast the sender object to the CommandBarDropDownList, but this doesn't work, because the sender is a type of RadDropDownListElement.
I need the Tag property from the CommandBarDropDownList item, because I use it in my following code.
If I cast the sender object to the RadDropDownListElement, the Tag property is null!

Is this a bug?

Regards
Marco

Stefan
Telerik team
 answered on 19 Mar 2012
3 answers
135 views
Hi.. again
What event should be used to 'grab' the value of a node... when a user clicks on it?
thanks again.....................
Stefan
Telerik team
 answered on 19 Mar 2012
3 answers
274 views
I create new item class
    public class MyCustomVisualItem : SimpleListViewVisualItem
    {
        private LightVisualElement _contentElementName;
        private LightVisualElement _contentElementState;
 
        private StackLayoutPanel _stackLayoutH;
        private StackLayoutPanel _stackLayoutV;
 
        private ImagePrimitive _image1;
        
        protected override void CreateChildElements()
        {
            base.CreateChildElements();
 
            _stackLayoutH = new StackLayoutPanel
            {
                Orientation = Orientation.Horizontal,
                EqualChildrenWidth = false
            };
 
            _stackLayoutV = new StackLayoutPanel
            {
                Orientation = Orientation.Vertical,
                EqualChildrenWidth = true,
                Margin = new Padding(10,0,0,0)
            };
 
            _image1 = new ImagePrimitive
            {
                Image = (Image)Resource1.ResourceManager.GetObject("Anonymous"),
                Alignment = ContentAlignment.MiddleLeft
            };
            _stackLayoutH.Children.Add(_image1);
 
 
            _contentElementName = new LightVisualElement
            {
                StretchHorizontally = true,
                Alignment = ContentAlignment.MiddleLeft,
                ImageAlignment = ContentAlignment.MiddleLeft,
                TextAlignment = ContentAlignment.MiddleLeft,
                Image = (Image)Resource1.ResourceManager.GetObject("Untitled_1s"),
                TextImageRelation = TextImageRelation.ImageBeforeText
            };
            _stackLayoutV.Children.Add(_contentElementName);
 
            _contentElementState = new LightVisualElement
            {
                StretchHorizontally = true,
                Alignment = ContentAlignment.MiddleLeft,
                TextAlignment = ContentAlignment.MiddleLeft,
                ForeColor = Color.Gray,
            };
            _stackLayoutV.Children.Add(_contentElementState);
 
            _stackLayoutH.Children.Add(_stackLayoutV);
 
            Children.Add(_stackLayoutH);
        }
 
        protected override void SynchronizeProperties()
        {
            base.SynchronizeProperties();
 
            Text = "";
            _contentElementName.Text = Convert.ToString(Data["Name"]);
            _contentElementState.Text = "Life is Good";
 
        }
 
        protected override Type ThemeEffectiveType
        {
            get
            {
                return typeof(SimpleListViewVisualItem);
            }
        }
    }

add to item creating
 	
	public RadForm1()
        {
            InitializeComponent();
            this.radListView1.Columns.Add("Name");
            this.radListView1.Items.Add(new ListViewDataItem("text"));
            this.radListView1.Items[0]["Name"] = "User";
        }
 
        private void radListView1_VisualItemCreating(object sender, Telerik.WinControls.UI.ListViewVisualItemCreatingEventArgs e)
        {
            e.VisualItem = new MyCustomVisualItem();
        }
 
        private void radListView1_SelectedItemChanged(object sender, EventArgs e)
        {
            int s = 2;
        }
Action radListView1_SelectedItemChanged in ListView doesn't work when i click on LightVisualElement element in my custom ListView item.
When click on free space in the item or on ImagePrimitive element all work and selected item changing.
How can i fix it?
Stefan
Telerik team
 answered on 19 Mar 2012
4 answers
279 views
Hi guys,

I'm working on a program where I need to change Text and ToolTips of different RadRibbonBar Elements.
The reason for this is that I need to be able to change the language on the fly.
This came as a request for an already existing program.
As the language will be changed for the whole program and all windows, I wanted to use a public function,
that will be called when I press a button and when a window is loaded / get the focus.
The Language information itself is stored in a database table.


private void radButtonElementEnglish_Click(object sender, EventArgs e)
{
     ChangeLanguage(this, "English")
}


Changing Text  and ToolTips on Textbox, RadTextBox or other controls is no problem. I just can't find a way to iterate though a RadRibbonbar. Same counts for Tooltips on a RadGridView.
I added further table columns that hold names and types of RibbonBarElements as kind of a path to get to an element.
"radRibbonBar.ribbonTab.radRibbonBarGroup", "radRibbonBar<Form.Name>.ribbonTabMain.radRibbonBarGroupSave"
Still din't find a way to diretcly address a RadButtonElement for example.

public void ChangeLanguage(Form frm, String Language = "English")
{
 RadTextBox RadTextBoxTip = null;
 RadDropDownListCustom radDropDownListCustomTip = null;
 RadLabel radLabelTip = null;
 RadButtonElement radButtonElementTip = null;
 RadGridView radGridViewTip = null;
 SqlCommand commandGetData = null;
 try
 {
    commandGetData = SQLQuery();
    commandGetData.CommandText = "SELECT  Element_Name, Element_Typ, Element_Text_EN, ToolTip_Text_EN, Element_Text_DE, ToolTip_Text_DE, From Language WHERE Windowr_Name = @Window_Name";
    commandGetData.Parameters.AddWithValue("@Window_Name", frm.Name.ToString());
    commandGetData.Connection.Open();
    SqlDataReader DataReader = commandGetData.ExecuteReader();
    if (DataReader.HasRows)
    {
         while (DataReader.Read())
    {
     switch (DataReader["Element_Typ"].ToString())
     {
       case ("radTextBox"):
          RadTextBoxTip = (RadTextBox)frm.Controls.Find(DataReader["Element_Name"].ToString(), true)[0];
          if (Language == "English")
          {
        RadTextBoxTip.Text = DataReader["Element_Text_EN"].ToString();
        RadTextBoxTip.TextBoxElement.TextBoxItem.ToolTipText = DataReader["ToolTip_Text_EN"].ToString();
          }
          if (Language == "German")
          {
        RadTextBoxTip.Text = DataReader["Element_Text_DE"].ToString();
        RadTextBoxTip.TextBoxElement.TextBoxItem.ToolTipText = DataReader["ToolTip_Text_DE"].ToString();
          }
          break;
       case ("radLabel"):
            radLabelTip = (RadLabel)frm.Controls.Find(DataReader["Element_Name"].ToString(), true)[0];
        // same as radtextbox
        //radLabelTip.Text
        //radLabelTip.LabelElement.ToolTipText
        break;
       case ("radRibbonbonbar"):
        //..
        RadRibbonBar RadRibbonbarTip = (RadRibbonBar)frm.Controls.Find(DataReader["Element_Name"].ToString(), true)[0];
        //RadRibbonbarTip.Text = ..
        //No Tooltip here
        break;
       case ("ribbonTab"):
        //..
        break;
       case ("radButtonElement"):
            var c = GetAll(frm, typeof(RadRibbonBar));
        MessageBox.Show("Total Controls: " + c.Count());
        break;
       //more case:
       default:
        break;
     }
    }
    DataReader.NextResult();
       }
    commandGetData.Connection.Close();
      }
      catch (System.Data.SqlClient.SqlException ex)
      {
    // showEvents(ex);
      }
      finally
      {
    if (commandGetData != null) { commandGetData.Dispose(); }
      }
   }
 }
 
public IEnumerable<Control> GetAll(Control control, Type type)
{
   var controls = control.Controls.Cast<Control>();
   return controls.SelectMany(ctrl => GetAll(ctrl, type))
  .Concat(controls)
  .Where(c => c.GetType() == type);
}

There is another thread has some info but I'm still not able to figure out how to solve my problem
http://www.telerik.com/community/forums/winforms/ribbonbar/findcontrol-to-find-a-radbuttonelement.aspx


many thanks,
-Michael

Michael
Top achievements
Rank 1
 answered on 19 Mar 2012
1 answer
154 views

We are using Winforms Q3 2011.  In our application, many of our dropdown lists are populated from lookup tables, so we have a generic method that maps to a lookup type, and we set the datasource to that:

Dim MyList as List(of AC.Lookup) = '... EF code
ddl.DataSource = MyList

Many of the lists are not required fields, so the proper default is to have nothing selected.  When this is the case, however, the dropdown lists will have "AC.Lookup" displayed (where AC is the namespace for this EDMX file).  After investigating, what appears to be happening is that the datasource doesn't quite know what to do with an empty list, so somehow it is calling the ToString.

This is confusing to the users. :-)  I first looked for a "default text" or some other such property on the dropdown list, and when I couldn't find that, I tried to do various hacks, mainly around setting the text to nothing after some event (DataBinding, TextChanged, whatever).  That method failed, too.  What I ended up doing was creating a partial class tied to the Lookup class (the original Lookup class is generated from the designer, so I didn't want to change it), overriding ToString to return String.Empty.  That worked and solved our problem, but it still seems very hackish.

Do you have a better, more elegant solution?

Thanks!

Ivan Todorov
Telerik team
 answered on 16 Mar 2012
1 answer
140 views
Hi All,

a have this procedure :

foreach (GridViewDataColumn dataColumn in radGridBatches.Columns)
 {               
      dataColumn.TextAlignment = ContentAlignment.BottomRight;
      dataColumn.FormatString = "{0:F2}";
}





but the number in Grid are 600
                                           592.35
                                          600
                                           etc...
need somebody help ?

lot thanks Alda

PROBLEM SOLVED, DOUBLE CONVERTED TO DECIMAL
Ivan Petrov
Telerik team
 answered on 16 Mar 2012
2 answers
89 views
I am new to Telerik controls and am working my way through the documentation as writing a project with the controls.

Our Dock panel will start empty and new tabbed documents and tool windows will be added in code (docking user controls). If a new tool window is added i need to dock it to the left. But, if a tool window already exists docked to the left then I need the new window to become a tab, rather than docking between that and the main window.

Imagine I have 3 user controls A, B, C, multiple sopies of which may be instantiated as a tool window. Each time an addition one is instantiated, i need to to add itself to the tabs. but, of course, if it is the first then it needs to simply dock left.

If anybody can help with this, that would be great!

Thank you in advance
Tony
Tony
Top achievements
Rank 1
 answered on 16 Mar 2012
2 answers
112 views
Hello, it's me again!

I will be adding tabbed documents and tool windows in code and of course it's straight forward to set those into default locations. However, if the user moves this tool window then closes it (fully disposed), later to open it again, i'd like it to open in the location it was last placed. Is this possible or will I need to save some settings to recall ?

thanks in advance
Tony
Tony
Top achievements
Rank 1
 answered on 16 Mar 2012
1 answer
145 views
Hi 
i have gridview with a combox column.
My problem is i want to show combobox when the form is loaded.rather empty cell in the whole column of grid.and it gets the shape of 
combo when i double clik on it.
2nd issue is comboxbox got selected on double click.First click enables it and i have to make a 2nd click to drop the list.
I want to show the combobox droped on first click.

Help appreciated.
thnks
Stefan
Telerik team
 answered on 16 Mar 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?