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

RadWindow Confirm and Alert content doesn't word-wrap

13 Answers 817 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jarred Froman
Top achievements
Rank 1
Jarred Froman asked on 22 Mar 2010, 06:44 PM
Release 2010.1

If you enter a long message in the content of the Confirm or Alert functions for the RadWindow component, the message doesn't word wrap.  It just shows a horizontal scrollbar.

13 Answers, 1 is accepted

Sort by
0
Pana
Telerik team
answered on 25 Mar 2010, 09:46 AM
Hi Jarred,

Really long messages forced windows to grow to enormous size. You could get window which is 5 times longer than the actual browser width. If you don't want the horizontal scroll bar use as content TextBlock with TextWrapping enabled, Width set to about 400 and Text with the "This is a really long message to show that it doesn't word wrap properly and just shows a scrollbar!" message. If you just set content the ContentPresenter will create TextBlock for it with TextWrapping disabled.

Best wishes,
Panayot
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Marc Roussel
Top achievements
Rank 2
answered on 23 Mar 2011, 07:22 PM
Huh ?

How do you do that if you use this kind of code ? Which the RadWindow is Static
If I instantiate a RadWindow I loose the Confirm method

Message = "Ceci va fermer la production courante et créer une sous production.  Désirez-vous continuer ?";

RadWindow.Confirm(Message, new EventHandler<WindowClosedEventArgs>((s, args) =>
    {
        if (args.DialogResult == true)
        {
            SaveAndStopProduction(MatPre, NbTubes, true, IsItClosingRecoupe, IsContinue, false);
            CopyJob(IsContinue);
        }
    }));
0
Pana
Telerik team
answered on 25 Mar 2011, 04:35 PM
Hi Marc,

You do not "RadWindow.Confirm(string...." but rather "RadWindow.Confirm(UIElement...". Try setting:

RadWindow.Confirm(new TextBlock() { Text = Message, TextWrapping = TextWrapping.Wrap, Width = 250}, ...

Note that when you set string as content a TextBlock is generated in the ContentPresenter inside the Control and the TextBlock does not wrap the text by default.

Best wishes,
Pana
the Telerik team
0
Marc Roussel
Top achievements
Rank 2
answered on 25 Mar 2011, 05:07 PM
That's good.  very cool
Thank you
0
Jonx
Top achievements
Rank 2
answered on 17 Aug 2011, 12:44 PM
Hello Pana,
Your trick is working but it would seem logical that this is done by default for strings...
Because now I have to wrap all the call to Dialog.Confirm in a helper that makes the conversion in case the text gets too long...
Would you consider changing this by default in the framework ?
Thank you,
John.
0
Pana
Telerik team
answered on 19 Aug 2011, 12:43 PM
Hello John,

Some time ago we have considered not to change that behavior. I am sorry for the inconvenience. Using a helper class or an extension method on the RadWindow would be the best solution.

Kind regards,
Pana
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
0
Jonx
Top achievements
Rank 2
answered on 29 Aug 2011, 02:44 PM
No problem, I understand...
Thanks.
0
Goran
Top achievements
Rank 1
answered on 28 Jan 2012, 10:53 AM
Hi, We are exploring the capabilities of your silverlight controls, and find this behavior very strange.

[quote]Really long messages forced windows to grow to enormous size. You could get window which is 5 times longer than the actual browser width[/quote]

If control is properly designed, this could never happen. If you set maximum width and maximum height for the window, then just use vertical scrollbar for making sure that message it displayed in whole.

[quote]Some time ago we have considered not to change that behavior. [/quote]

May I ask what is the reason for this decision? Its not natural to leave to programmer to create a wrapper class for such a simple task, since for every application that is being localized, using RadWindow straight from the box is not possible.


Thanks,
Goran
0
Goran
Top achievements
Rank 1
answered on 28 Jan 2012, 11:06 AM
I see now that in order to support localization, we need to use DialogParameters in order to localize buttons, so making a wrapper is a must. By the way, if you set Header to empty string, it will still display Confirm, probably some kind of bug, you need to enter at least one space.
0
Pana
Telerik team
answered on 30 Jan 2012, 08:00 AM
Hi,

I see why you would think that it is natural for us to put a MaxWidth in the alert/prompt/confirm but also please note that WPF and Silverlight support other content types than strings. If you were to put a UserControl as a Content (which you could and you should be able to do) that have fixed with and height but a little larger than the sizes we have considered normal, It would get constrains from our hardcoded max width / height and you would have hard times getting rid of the scrollbars. And if we are to put these constraints only when the content is string it would get even more magical since the different texts would look fine with different widths in the different languages.

Regards,
Pana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Goran
Top achievements
Rank 1
answered on 30 Jan 2012, 08:19 AM
I agree, but then a way around is to put height constraint on default TextBlock, this way there would be no side effects you are describing.
0
Pana
Telerik team
answered on 02 Feb 2012, 10:59 AM
Hello,

We've already discussed such issues. And we've made our decision. Even if we decide to do it now it will introduce breaking changes.

Kind regards,
Pana
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Max
Top achievements
Rank 1
answered on 03 Apr 2012, 03:50 PM
How About fork to RadTextAlert or
RadAlert(params, forceTextWrap=true) and let user care about what he puts in RA controls...
Tags
Window
Asked by
Jarred Froman
Top achievements
Rank 1
Answers by
Pana
Telerik team
Marc Roussel
Top achievements
Rank 2
Jonx
Top achievements
Rank 2
Goran
Top achievements
Rank 1
Max
Top achievements
Rank 1
Share this question
or