This is a migrated thread and some comments may be shown as answers.

Vertical center and bolder to each image item

2 Answers 35 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Son
Top achievements
Rank 1
Son asked on 20 Jan 2016, 07:07 AM
I want to have a list image as blocks with border.
I tried using stackpanel or not but i can not set item in ListBoxItem to center.
---
My listbox.ItemsSource is list of bitmapimage converted from base64string in data from web api. So they don't have urls.
My xaml is in 1.png
Debug to actual-img.png. I want to have list such as wanted-img.png or wanted-img2.png.
Can you help me, please?
---
I need click to image, it will show an actual-size image (i can do this) but do you think i should try RadTileList? 
---
Thank you. 

2 Answers, 1 is accepted

Sort by
0
Accepted
Nasko
Telerik team
answered on 22 Jan 2016, 11:18 AM
Hi Son,

In order to center the images as expected the VerticalContentAlignment of the ListBoxItems should be set to Center. You could do that from the Style of RadListBoxItem as shown below:
<Style TargetType="telerik:RadListBoxItem">
    <Setter Property="VerticalContentAlignment" Value="Center"/>
</Style>

Thus the images should be displayed in the center as expected. From the Style you could also set the desired brush and thickness of the border:
<Style TargetType="telerik:RadListBoxItem">
    <Setter Property="VerticalContentAlignment" Value="Center"/>
    <Setter Property="BorderBrush" Value="Red"/>
    <Setter Property="BorderThickness" Value="1"/>
    <Setter Property="Margin" Value="2"/>
</Style>

Hope this helps.

Regards,
Nasko
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Son
Top achievements
Rank 1
answered on 25 Jan 2016, 02:52 PM
Thank you, Nasko. It's exactly what i need. 
Tags
ListBox
Asked by
Son
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Son
Top achievements
Rank 1
Share this question
or