Inserting Image in the RadPanelBarItem

3 posts, 0 answers
  1. prabhu.m
    prabhu.m avatar
    3 posts
    Member since:
    Aug 2010

    Posted 28 May 2011 Link to this post

    Hi please,
    Let me know how to insert image in RadPanelBarItem

    Thanks
    M.Prabhu
  2. Kiril Stanoev
    Admin
    Kiril Stanoev avatar
    1511 posts

    Posted 28 May 2011 Link to this post

    Hi prabhu.m,

    It depends on your scenario. There are 3 ways do define an image within a RadPanelBarItem.

    • Using XAML
    <telerik:RadPanelBar>
        <telerik:RadPanelBarItem>
            <telerik:RadPanelBarItem.Header>
                <StackPanel Orientation="Horizontal">
                    <Image Source="Images/mySamplePic.png" />
                    <TextBlock Text="Sample Text" VerticalAlignment="Center" Margin="5 0" />
                </StackPanel>
            </telerik:RadPanelBarItem.Header>
        </telerik:RadPanelBarItem>
    </telerik:RadPanelBar>

    • Code behind
    RadPanelBar panelBar = new RadPanelBar();
    RadPanelBarItem panelBarItem = new RadPanelBarItem();
    StackPanel stackPanel = new StackPanel();
    stackPanel.Orientation = Orientation.Horizontal;
    Image image = new Image();
    image.Source = new BitmapImage(new System.Uri("/Images/mySamplePic.png", System.UriKind.RelativeOrAbsolute));
    TextBlock textBlock = new TextBlock();
    textBlock.Text = "Sample Text";
    textBlock.Margin = new System.Windows.Thickness(5,0,0,0);
    textBlock.VerticalAlignment = System.Windows.VerticalAlignment.Center;
    stackPanel.Children.Add(image);
    stackPanel.Children.Add(textBlock);
    panelBarItem.Header = stackPanel;
    panelBar.Items.Add(panelBarItem);


    Kind regards,
    Kiril Stanoev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. prabhu.m
    prabhu.m avatar
    3 posts
    Member since:
    Aug 2010

    Posted 29 May 2011 Link to this post

    Thanx, great
Back to Top