Is it possible to position the items in an UltraOptionSet individually?
Hi,
There are no properties for this. Depending on what you want, you might be able to achieve it with a CreationFilter. But without more information about exactly what you are trying to position and where you want to position it, it's hard to say.
Well it's very simple, I just want to be able to position the separate radiobutton items in the UltraOptionSet, just like the normal RadioButton control.
I would have used the normal RadioButton but my application is styled so I'm 'stuck' with this Infragistics control...
Currently I'm solving it by placing an UltraOptionSet for each separate radiobutton and then solving the check/unchecking with the ValueChanged event but it's not something that is very flexible.
Hi Erik,
I'm still not sure what you are trying to do exactly. It sounds like you just want to put space between the items so you can place other controls in between them. If that's the case, then you can use the ItemSpacingVertical or ItemSpacingHorizontal properties on the control.
Also, you don't necessarily have to use UltraOptionSet for styling. AppStylist is capable of styling the inbox RadioButton control. Of course, it can only style it within the limitations of the control itself, so you cannot change the look of the radio button itself, but you can set the BackColor and ForeColor on the control. To style the inbox controls, you have to make sure that the isl file you are using includes styling for those controls and you also have to place an InboxControlStyler component on any form you want styled.
ItemSpacing makes the spacing for all items the same. I want to have different spacing between the items. For example item one should be located at 0,0. Item 2 at 20,50. Item 3 at 15,70.
Okay, that should be pretty easy to do with a CreationFilter.
If you want to try it out, I recommend get the Infragistics UIElementViewer Utility.
This utility is a huge help when working with CreationFilters because it allows you to see the UIElement hierarchy of the control.
Basically, you just need to find the UIElement that contains the options and trap the AfterCreateChildElements for that phase. Then you can re-position the child elements wherever you want with the parent by setting the Rect.
Here's some quick sample code I threw together:
this.ultraOptionSet1.CreationFilter = new MyOptionSetCreationFilter();
public class MyOptionSetCreationFilter : IUIElementCreationFilter { #region IUIElementCreationFilter Members public void AfterCreateChildElements(UIElement parent) { if (parent is OptionSetEmbeddableUIElement) { foreach (UIElement element in parent.ChildElements) { ValueListItem item = element.GetContext(typeof(ValueListItem)) as ValueListItem; switch (item.DataValue.ToString()) { case "ValueListItem0": element.Rect = new Rectangle(0, 0, element.Rect.Width, element.Rect.Height); break; case "ValueListItem1": element.Rect = new Rectangle(20, 50, element.Rect.Width, element.Rect.Height); break; case "ValueListItem2": element.Rect = new Rectangle(15, 70, element.Rect.Width, element.Rect.Height); break; } } } } public bool BeforeCreateChildElements(UIElement parent) { // Do nothing return false; } #endregion }
I have also attached a sample project with the same code.