Manish Pansiniya's Blog

.NET, C#, Javascript, ASP.NET and lots more…:)

StackPanel’s Example

with one comment

Following is the best example of using StackPanel. It is taken from unleashed. Thanks to Adam Nathan.

<CheckBox Height="18.337" HorizontalAlignment="Left" VerticalAlignment="Top" Width="173.368">
            CheckBox
            <CheckBox.ToolTip>
                <StackPanel>
                    <Label FontWeight="Bold" Background="Blue" Foreground="White">
                        The CheckBox
                    </Label>
                    <TextBlock Padding="10" TextWrapping="WrapWithOverflow" Width="200">
                        CheckBox is a familiar control. But in WPF, it’s not much
more than a ToggleButton styled differently!
                    </TextBlock>
                    <Line Stroke="Black" StrokeThickness="1" X2="200"/>
                        <StackPanel Orientation="Horizontal">
                            <Image Margin="2" />
                                <Label FontWeight="Bold">Press F1 for more help.</Label>
                        </StackPanel>
                </StackPanel>
            </CheckBox.ToolTip>
        </CheckBox>

Following is the output of the above code. See the label, TextBlock and line are stacked vertically an Image and Help stacked horizontally. I have removed the image from it as I dont have the same.

image

It’s the better example of StackPanel.

Advertisements

Written by Manish

October 19, 2007 at 8:48 am

Posted in .NET 3.0, WPF

One Response

Subscribe to comments with RSS.

  1. I am looking to use the horizontal stackpanel but at the same time automatically load images with databinding to it.

    Can it be done?

    Annonimus

    November 16, 2007 at 7:15 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: