views:

354

answers:

2

I need you a TextWrapping in the WPF CheckBox.

Please look at this two samples:

<CheckBox>  
  <TextBlock TextWrapping="Wrap"  
             Text="_This is a long piece of text attached to a checkbox."/>  
</CheckBox>

<CheckBox>  
  <AccessText TextWrapping="Wrap"  
              Text="_This is a long piece of text attached to a checkbox."/>  
</CheckBox>

If I use a TextBlock in the Content of the CheckBox, the check element (vertical alignment is top) and the text displays properly, but not the accelerator.

alt text

If I use an AccessText in the Content of the CheckBox, the check element displays wrong (vertical alignment is center).

How to change the style of the elements to display this CheckBox correct?

A: 

If you combine the two you will probably get the effect you desire.

<CheckBox>
    <TextBlock>
        <AccessText TextWrapping="Wrap"  
                    Text="_This is a long piece of text attached to a checkbox."/>  
    </TextBlock>
</CheckBox>
wpfwannabe
seems like it doesn't work on 3.5sp1
DK
I have tried, it doesn't work. You can try it very fast using e.g the XamlPad.
Shurup