Kamis, 10 Oktober 2013

How to Place an Image in Toolbar Control: WPF

Toolbar control is used to place some shortcuts in the windows environment. We can use this toolbar in our WPF application as used in our previous post. In this post, we will place an image control in to this toolbar.

We can directly place the image or we can use a stack panel to use an image. Just write the following XAML code:

<ToolBar VerticalAlignment="Bottom">
<StackPanel Orientation="Horizontal">
<Label Content="Image 1"></Label>
<Image Source="buttonImage.png" Width="80" Height="40"></Image>

<Label Content="Image 2"></Label>
<Image Source="image1.png" Width="80" Height="40"></Image>
</StackPanel>
</ToolBar>

Run the above code and it will place two label control with two images respectively. These two images are placed in my solution files. The images are fix proportionally according to the width and height provided.

How to place an image control in ToolBar Control: WPF XAML


The same process may be done by the c# code (through code behind file). We can use as many images as we want to use in a single toolbar control. In the next article we will load a user control in this toolbar control.

See Also: How to Load UserControl in Toolbar Control

Tidak ada komentar:

Posting Komentar