This is a migrated thread and some comments may be shown as answers.

raddatetimepicker hosted in a toolstrip

3 Answers 104 Views
Toolstrip (obsolete as of Q3 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mike
Top achievements
Rank 2
Mike asked on 02 Jun 2009, 12:43 PM
Hi there,

I can't seem to get a datepicker in a radhostitem (added to a toolstrip programmatically) to sit in line with the other controls on the toolstrip.

rtsi_Context is a RadToolStripItem

My code looks like this:-

    RadDateTimePicker dtPicker = new RadDateTimePicker();
            dtPicker.Name = "dtPicker";
            dtPicker.ThemeName = "Office2007Blue";
            RadHostItem hostItem = new RadHostItem(dtPicker);
            hostItem.MinSize = new Size(150, 10);
            hostItem.MaxSize = new Size(150, 10);
            //Add the item to the context menu
            this.rtsi_Context.Items.Add(hostItem);
            //Save a reference for later use.
            rdtp_Rundate = dtPicker;
            rdtp_Rundate.ValueChanged += new EventHandler(rdtp_Rundate_ValueChanged);

I tried setting various MinSize attributes for the Toolstrip and its various components- other controls aligned themselves appropriately but the radhostitem / datetimepicker appeared "stuck" to the bottom of the RadToolStrip container.

I put the above code into a button click handler just to make sure that I wasn't attempting to add the control before the toolstrip was initialized correctly, but with the same results.

Many thanks,
Mike Renwick

3 Answers, 1 is accepted

Sort by
0
Accepted
Martin Vasilev
Telerik team
answered on 05 Jun 2009, 11:06 AM
Hello Mike,

Thank you for writing. I have to admit that we have some layout issues with the current version of RadToolStrip, because it still uses the old layout system. The good news is that we are working on implementing new layouts in the next versions of RadToolStrip, that should address the issues like this. Currently, I have managed to find a work-around by set the Min and Max size for the DateTimePicker element and the HostItem. After that I use PositionOffset property of HostedItem to line up the DateTimePicker with other controls. Please, review the code-block below:

RadDateTimePicker datePicker = new RadDateTimePicker();  
datePicker.MinimumSize = new Size(150, 19);  
datePicker.MaximumSize = new Size(150, 19);  
 
hostItem = new RadHostItem(datePicker);  
hostItem.MinSize = new Size(150, 14);  
hostItem.MaxSize = new Size(150, 14);            
 
this.radToolStripItem1.Items.Add(hostItem);  
hostItem.PositionOffset = new SizeF(0, -3); 

I hope this helps. Do not hesitate to contact me again if you have other questions.

All the best,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Mike
Top achievements
Rank 2
answered on 08 Jun 2009, 10:40 AM
Workaround works fine thanks - quite happy to work with workarounds until newer versions, thanks for taking the time to resolve this.
Regards,
Mike
0
Martin Vasilev
Telerik team
answered on 10 Jun 2009, 03:21 PM
Hi Mike,

Thank you for getting back to me. I am glad that this suits your scenario. Write me back if you need additional assistance.

Kind regards,
Martin Vasilev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Toolstrip (obsolete as of Q3 2010)
Asked by
Mike
Top achievements
Rank 2
Answers by
Martin Vasilev
Telerik team
Mike
Top achievements
Rank 2
Share this question
or