Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2007

Tip: Looking for answers? Try searching our database.

XAML, dynamically created RadioButton, and WordWrap?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tore Bostrup - 03 Oct 2007 07:11 GMT
I have an app that presents a variable number of radio buttons (with
variable text) that are created dynamically on a HeaderedItemsControl.  As
far as I can tell, the RadioButton doesn't supports (word or otherwise)
wrapping, but will present multiple lines of text, so I could implement word
wrapping by inserting NewLine(s) if I could just determine how wide my text
is...  It is occasionally too wide for a single line, and could
theoretically be several lines.

I would *really* like to do this when I create the controls and assign the
texts and handlers (this is after the window has been shown), but while I
can get the initial DesiredSize AND the first iteration after that, it seems
I can't get there from here:  It won't tell me the size until the layout is
final - but the layout won't be final until I know the size of my display
text.

What can I do (.Net 2.0 w/FW 3.0, VB preferred, but except for some
differences in threading and delegates, I can deal with C#)?

TIA,
Tore
Tore Bostrup - 06 Oct 2007 06:00 GMT
Well,

I don't know if the question was too dumb or whether there just aren't many
XAML folks on these lists, but I finally found my answer...

Instead of using a string as content, I added a TextBlock element containing
the string and with TextWrapping on:

Dim checkTextBlock As TextBlock = New TextBlock()

checkTextBlock.TextWrapping = TextWrapping.Wrap

checkTextBlock.Text = StripEndingLineFeeds(choice.Text)

checkAnswer.Content = checkTextBlock

This works like a charm, at least in a StackPanel, which may have been more
appropriate anyway.

Tore.

>I have an app that presents a variable number of radio buttons (with
>variable text) that are created dynamically on a HeaderedItemsControl.  As
[quoted text clipped - 16 lines]
> TIA,
> Tore

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.