locked
text wrap in radiobutton label RRS feed

  • Question

  • Hi,

    I believe the text used to auto wrap in case of Windows Forms radiobutton control but I don't see that happening in case of WPF radiobutton control.
    Strangely i did not find any good search result when I tried looking for a solution for this.
    Is there an option available somewhere to achive this, which I am missing?

    (I am new to WPF.)

    Thanks in advance.

    With regards,
    Software Engineer
    Thursday, May 14, 2009 12:54 PM

Answers

  • Hi,

     

    -->Strangely i did not find any good search result when I tried looking for a solution for this.Is there an option available somewhere to achive this, which I am missing?

     

    You can bind the width of the content(like TextBlock) to the width of the RadioButton, alternatively, you can set the MinWidth property of TextBloxk:

     

         <StackPanel>

                <!--use DataBinding-->

                <RadioButton>

                    <RadioButton.Content>

                        <TextBlock Text="Check1"

                                   Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type RadioButton}}}" />

                    </RadioButton.Content>

                </RadioButton>

                <!--use MinWidth-->

                <RadioButton>

                    <RadioButton.Content>

                        <TextBlock Text="Check2"

                                   MinWidth="100" />

                    </RadioButton.Content>

                </RadioButton>

            </StackPanel>


    If you are still having additional issues with this, please feel free to ask.
    Thanks.


    Jim Zhou -MSFT
    Monday, May 18, 2009 11:04 AM