forum

Home / DeveloperSection / Forums / WPF Button with multiple text elements

WPF Button with multiple text elements

Anonymous User 2180 04-Sep-2013

I am trying to create buttons for a 10-foot GUI using WPF. Each button requires a little more data than just a single text string and an image, maybe 2-3 strings located in different positions and some imagery.

I have tried

 <Button
Height="52" HorizontalAlignment="Stretch"
Name="button1" 
Width="407">
        <Button.Content>
        <DockPanel LastChildFill="True" HorizontalAlignment="Stretch">
            <TextBlock Name="textBloczk2" Text="ABC" TextAlignment="Left"   DockPanel.Dock="Left"/>
            <TextBlock Name="textBlxock1" Text="CDE" TextAlignment="Right" DockPanel.Dock="Right"/>
        </DockPanel>
        </Button.Content>
    </Button>

But no matter which inner container I use, the button seems to disregard the layout from the DockPanel and the combined text ends up in the middle of the button. Am I doing something wrong or should I be using a different outer container ?


wpf wpf 
Updated on 04-Sep-2013
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By