Current filter:
                                You should refresh the page.
                                  • Hi, I have a WindowsUIButtonPanel with some buttons that have black images. When the button is in the Pressed state, the image is hard to see because of the black circle fill.

                                    I see 2 solutions here and am wondering if you can help figure out the best way to go about them:

                                    1. I can have some white SVG image variants in my project resources, but when is the best event to apply them? I have tried MouseDown, but it applies to the entire control (not just the buttons), and it would also set the white image if the mouse were released outside the button. ButtonChecked also doesn't work because it only fires when you release the mouse - you would see the black image while holding down the mouse.
                                    2. Can the fill color of the circle be changed without affecting the text or circle shape?

                                    Honestly, I think option 1 is my preferred choice here.

                                    Note:

                                    1. I have glyph skinning disabled for a reason (these are SVG images).
                                    2. The colorization mode is set to None because when switching between light and dark skins, it would change the color of the SVGs. I always want them black when not Pressed.

                                    I have attached a sample project so you can see how clicking the buttons makes the images hard to see.

                                1 Solution

                                Creation Date Importance Sort by

                                Hi,

                                If you wish to assign a different image to a button when it is pressed, handle the WindowsUIButtonPanel.MouseDown event. To know what button is clicked, use the WindowsUIButtonPanel.CalcHitInfo method:

                                [C#]
                                private void OptionsButtonPanel_MouseDown(object sender, MouseEventArgs e) { var button = OptionsButtonPanel.CalcHitInfo(e.Location); if(button != null) { //... } }

                                In addition, you can handle the MouseUp event to ensure that the mouse button is released over a button.

                                Let me know if this information is helpful.

                                • Eaton Z. 11.11.2019

                                  Through a lot of trial and error, I got it working the way I want.
                                  However, I may have discovered a bug in the process. Your SvgImageCollection documentation states:
                                  If you do not manually specify an image size on a control's side (the ImageOptions.SvgImageSize property), a vector image has this default size.

                                  The collection I placed on my form has the default size set to 32x32. When this is assigned to a WindowsUIButtonPanel and the button's ImageIndex property is set alongside the SvgImageSize property, it chooses the collection's size over the SvgImageSize property I have set for the button.

                                  I have attached a sample. Note how the collection assigned to the WindowsUIButtonPanel has 32x32 as the image size, but the buttons themselves have a different SvgImageSize - yet SvgImageSize is not respected.

                                  Interestingly, when you click them at runtime, the image sizes correct themselves.

                                • Svetlana (DevExpress Support) 11.12.2019

                                  Hi,

                                  We have successfully reproduced the behavior you described and passed a new WindowsUIButtonPanel - The SvgImageSize property is not in effect ticket to our developers' team for further research. Please bear with us. We will notify you as soon as we make any progress.

                                • Eaton Z. 11.12.2019

                                  Thank you, Svetlana.
                                  I am also attaching an updated sample project with a few fixes to my implementation, in case anyone else may find it useful later.