Hello,
i use an UltraToolBar with an PopupColorPickerTool. I need to style the CustomColorBox of this tool, as u can see below.
I want to change the forecolor of the buttons "Transparent" and "More Colors..." to white. I tried with AppStylist, but found no properties for colors of the ColorBox buttons. I can accept a solution to set the background of the CustomColorBox (buttons).
I also tried to implement a CustomControl myself inheriting of the Infragistics CustomColorBox, but did not succeed - did not found the Properties..
PS: I also may want to localize it..
- Additionally i want a "No Color" button, resetting the forecolor formatting. But first of all the problem described above..
GreetingsiA. Kits
It appear that your post has three separate (but related) questions, so lets tackle them one at a time.
First, you can change the forecolor of the buttons on the CustomColorBox by either setting the PopupAppearance.ForeColor on the PopupColorPickerTool within your application, or by setting the Button UIRole if using Application Styling. Changing the Button UIRole will affect more than just the CustomColorBox though, so you may want to create a new StyleSet within your style library, and set this new StyleSet as the default for the CustomColorBox.
Next, in regards to your localization question, most of our control-defined strings can be localized via the ResourceCustomizer. The resource strings for the CustomColorBox can be found here.
Finally, as far as a "No Color" button is concerned, our current PopupColorPickerTool does not have support for a "No Color" button.
Let me know if you have any further question.
Chris
Hi Chris,
thanks for your response. I could resolve the button text color problem by set the Button UIRole. (I tried PopupAppearance before, but its got overriden by the Style.)
I could localize it by Using the ResourceCustomizer on Infragistics.Win.Resources.
Still im trying to add a "No Color" button. I implemented a custom UserControl inheriting from PopupColorPickerTool. I override the Control property, but it looks like this its not used as expected. I get the CostumColorBox, but changes takes no effect.
The PopupColorPickerTool is not designed so it can have it's color box control easily replaced via inheritance. The Control property is a "lazy getter", so the CustomColorBox is created and initialized (including having it's ColorChanged and Disposed events subscribe to) in the getter. Since the rest of the tool implementation accesses a private colorControl member on the PopupColorPickerTool, the only way for you to effectively override it would be to use reflection to set this member and hook up all the appropriate events.
Instead of using a derived-PopupColorPickerTool, I recommend using a PopupControlContainerTool and assigning an instance of your own CustomColorBox. Just make sure to handle the ColorChanged event, so you can close the dropdown when a color is selected.
Let me know if you have further questions.
Hello Chris,
but even with a lazy load - i get the reference of the CustomColorBox, by the Control Property of the PopupColorPickerTool, and should be able to modify it, even without reflection. And i am able to, for example modify the ShowAutomaticColor property. But if i add a control to the Controls collection, its not displayed. And by the way, the collection is empty, where are the controls of your CustomColorBox? Do u really just paint it, and register on Click / coordinates?
In an example project i am able to modify the CustomColorBox, by adding a control to the Controls collection. But i am not able to do this in a PopupColorPickerTool.Control (CustomColorBox).
Even not with reflection:
var colorControlField = typeof(PopupColorPickerTool).GetField("colorControl", BindingFlags.NonPublic | BindingFlags.Instance);
var colorControl = colorControlField.GetValue(foreColorToolBase) as CustomColorBox; var btn = new UltraButton(); btn.Top = 2; btn.Left = 2; btn.Width = 245;
colorControl.Controls.Add(btn);
colorControlField.SetValue(foreColorToolBase, colorControl);
Or is there any way to catch the event clicked on the "automatic button" of the CustomColorBox? (I dont know in ColorChangedEvent, if it was by "automatic" or not.)
Can you provide me the source code of the CustomColorBox, or is this private?
Greetings
iA. Kits
The CustomColorBox is a single control, not a container control with child controls which is why the Controls collection is empty.
As a purchaser of the product, you have access to the source code for our control suite. It can be downloaded on the ‘Source Code’ tab of the My Keys and Downloads page, once you select a product.
If you’d like, you can replace the Automatic button UIElement with a new ‘Empty’ button UIElement via a creation filter. I’ve attached a sample that demonstrates how you can replace the CustomColorBoxAutomaticTrackingButtonUIElement with a CustomColorBoxSpecialButtonUIElement that uses Color.Empty.
Let me know if you need further assistance.
i've finally implemented the no color button, and your example worked, thanks.Greetings