Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
440
UltraMessageBoxManager ButtonUIElement ShowOutline
posted

Hi,

I have created a custom filter for the UltraMessageBoxManager in order to style the DialogButtons and set the "ShowOutline = false". The problem is that ButtonUIElement doesnt have that property.

Any clue?

#region IUIElementCreationFilter Members
public void AfterCreateChildElements(UIElement parent)
{

}
public bool BeforeCreateChildElements(UIElement parent)
{
if (parent is MessageBoxUIElement)
{
Form messagebox_form = ((MessageBoxUIElement)parent).Control.Parent as Form;
Point p = new Point(messagebox_form.Owner.Location.X + messagebox_form.Owner.Width / 2 - messagebox_form.Width / 2, messagebox_form.Owner.Location.Y + messagebox_form.Owner.Height / 2 - messagebox_form.Height / 2);
messagebox_form.Location = p;

}
if (parent is ButtonUIElement)
{


ButtonUIElement btn = (ButtonUIElement)parent;
// here i want to convert ButtonUIElement  to UltraButtonBase in order to have access to ShowOutline but the conversion or cast its impossible.

}
return false;
}

  • 48586
    posted

    Hello, ­­­­­

     

    I am just checking about the progress of this issue. Let me know If you need any further assistance on this  matter?

     

    Thank you for using Infragistics Components.

     

  • 48586
    posted

    Hello,

     

    ShowOutline determines whether an outline is rendered outside the button borders when the button is the default button, this meant that if the button is not default, outline will not be rendered. MessageBoxButtonUIElement has get/set property IsDefaulButton which determines if the button will be rendered as default button. So setting this property to false will produces the same result like setting of  ShowOutline to false. Then yours code should be:

     

    public void AfterCreateChildElements(UIElement parent)

            {

            }

     

            public bool BeforeCreateChildElements(UIElement parent)

            {

                if (parent is MessageBoxUIElement)

                {

                    Form messagebox_form = ((MessageBoxUIElement)parent).Control.Parent as Form;

                    Point p = new Point(messagebox_form.Owner.Location.X + messagebox_form.Owner.Width / 2 - messagebox_form.Width / 2, messagebox_form.Owner.Location.Y + messagebox_form.Owner.Height / 2 - messagebox_form.Height / 2);

                    messagebox_form.Location = p;

                }

     

                if (parent is MessageBoxButtonUIElement)

                {

                    MessageBoxButtonUIElement button = ((Infragistics.Win.UltraMessageBox.MessageBoxButtonUIElement)(parent));

                    button.IsDefaultButton = false;

                }

                return false;

     

            }

     

    Please let me know if you have any further questions.