473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

XAML, dynamically created RadioButton, and WordWrap?

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
Oct 3 '07 #1
1 2618
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.

"Tore Bostrup" <news @ akresoft . comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>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

Oct 6 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John Crowley | last post by:
I'm having an odd problem with viewstate and a dynamically created control inside a repeater template. Basically, I have a repeater setup like this in the aspx:
2
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
5
by: Amelyan | last post by:
How can I get state of dynamically created controls (RadioButton, CheckBox, TextBox.Text) on post back when I click submit button? The only way I know is by traversing Response.Form enumberator;...
1
by: Marcus | last post by:
I have a problem maybe one of you could help me with. I've created a data entry screen with lots of dynamically-created client-side controls. I create HTML texboxes client-side by assigning a...
2
by: Amelyan | last post by:
I *finally* narrowed down my problem to my custom web control. If I hookup event inside dynamically created custom web control, it doesn't get fired. However, event gets fired for any other...
2
by: D Hass | last post by:
Radio Buttons are added to my form During the Load event, the quantity determined by User input. They are placed in pairs on groupboxes with code like this: (edited a bit for brevity) Public...
10
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess...
1
by: Dica | last post by:
i've got a script that loops through a dataset and creates dynamic web controls and event handlers: while (oDr.Read()){ RadioButton oRb = new RadioButton(); oRb.ID = oDr.ToString();...
2
by: Nathan Sokalski | last post by:
I have LinkButtons that are dynamically created in one of the PostBack events. They must be created in the PostBack event because one of the variables required to determine which ones to create...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.