Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 139875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:30:49+00:00 2026-05-11T07:30:49+00:00

I have a ListBox with horizontal scrolling, and each item consists of a two

  • 0

I have a ListBox with horizontal scrolling, and each item consists of a two row grid. The first row contains an image, and the second row a border used to render a reflection of the first.
(Yeah, yeah. I know. Yet another coverflow attempt…)

I need some help with the sizing of the images. If I don’t specify any size, it will render the image at full size, but I want it to be restricted by height of the grid row. If the window resizes, the images should resize.

Any clues?

Update:
I have now changed the code a little. First of all I have removed a unnecessary trigger, but the important part is

  • Disabled vertical scrollbar on listbox.
  • Removed height on coverImage
  • Changed from layoutTransformation to RenderTransformation
  • Shrink non-selected item instead of scaling selected item.

This gives me nearly what I want. There is a gap between the coverImage and the coverReflection that I cant find a reason for. Any clues for that, og maybe I should post a new question…?

Second Update:
I think I have a solution for the reflection-gap to now. It feels a little awkward, though. I guess there are better ways of doing it.

What I’ve done is – I’m no longer flipping the border, I’m flipping the visual brush instead. – I have added a TileMode=’Tile’ for the visual brush

Now, I’m not sure why this works, but it’s coming close to what I want, so…

<Window     xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'     xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'     xmlns:d='http://schemas.microsoft.com/expression/blend/2008'      xmlns:mc='http://schemas.openxmlformats.org/markup-compatibility/2006'      mc:Ignorable='d'      x:Class='UntitledProject1.Window1'     x:Name='Window'     Title='Window1'     Width='801' Height='786'>     <Window.Resources>         <XmlDataProvider x:Key='dataProvider' XPath='Bilder'>             <x:XData>                 <Bilder xmlns=''>                     <Bilde>75760-1_-8589666289339775808.jpg</Bilde>                     <Bilde>73255-3_-8589662994232744558.jpg</Bilde>                     <Bilde>75760-1_-8589666289339775808.jpg</Bilde>                     <Bilde>73255-3_-8589662994232744558.jpg</Bilde>                     <Bilde>75760-1_-8589666289339775808.jpg</Bilde>                     <Bilde>73255-3_-8589662994232744558.jpg</Bilde>                 </Bilder>             </x:XData>         </XmlDataProvider>          <ControlTemplate x:Key='listControlTemplate' TargetType='{x:Type ListBoxItem}'>             <Grid x:Name='listItemGrid'>                 <Grid.RowDefinitions>                     <RowDefinition/>                     <RowDefinition/>                 </Grid.RowDefinitions>                       <Image x:Name='coverImage'                         Source='{Binding Path=InnerText}'                          Stretch='Uniform'                         HorizontalAlignment='Stretch'                         VerticalAlignment='Bottom'                          Grid.Row='0'                         RenderTransformOrigin='0.5,1'>                     <Image.RenderTransform>                         <TransformGroup>                             <ScaleTransform ScaleX='0.7' ScaleY='0.7'/>                             <SkewTransform AngleX='0' AngleY='0'/>                             <RotateTransform Angle='0'/>                             <TranslateTransform X='0' Y='0'/>                         </TransformGroup>                     </Image.RenderTransform>                 </Image>                 <Border x:Name='coverReflection'                          RenderTransformOrigin='0.5,0'                          Height='{Binding Path=ActualHeight, ElementName=coverImage, Mode= Default}'                          VerticalAlignment='Top'                          Grid.Row='1'                         >                     <Border.OpacityMask>                         <LinearGradientBrush EndPoint='0.0,1' StartPoint='0.0,0'>                             <GradientStop Color='#00000000' Offset='0.6'/>                             <GradientStop Color='#BBFFFFFF' Offset='0'/>                         </LinearGradientBrush>                     </Border.OpacityMask>                     <Border.RenderTransform>                         <TransformGroup>                             <ScaleTransform ScaleX='0.7' ScaleY='0.7'/>                             <SkewTransform AngleX='0' AngleY='0'/>                             <RotateTransform Angle='0'/>                             <TranslateTransform X='0' Y='0'/>                         </TransformGroup>                     </Border.RenderTransform>                     <Border.Background>                         <VisualBrush Visual='{Binding ElementName=coverImage}' TileMode='Tile'>                             <VisualBrush.Transform>                                 <TransformGroup>                                     <ScaleTransform ScaleX='1' ScaleY='-1'/>                                     <SkewTransform AngleX='0' AngleY='0'/>                                     <RotateTransform Angle='0'/>                                     <TranslateTransform X='0' Y='0'/>                                 </TransformGroup>                                                            </VisualBrush.Transform>                         </VisualBrush>                     </Border.Background>                 </Border>                            </Grid>             <ControlTemplate.Triggers>                 <Trigger Property='IsSelected' Value='True'>                                         <Setter Property='RenderTransform' TargetName='coverImage'>                         <Setter.Value>                             <TransformGroup>                                 <ScaleTransform ScaleX='1' ScaleY='1'/>                                 <SkewTransform AngleX='0' AngleY='0'/>                                 <RotateTransform Angle='0'/>                                 <TranslateTransform X='0' Y='0'/>                             </TransformGroup>                         </Setter.Value>                     </Setter>                                        <Setter Property='RenderTransform' TargetName='coverReflection'>                         <Setter.Value>                             <TransformGroup>                                 <ScaleTransform ScaleX='1' ScaleY='1'/>                                 <SkewTransform AngleX='0' AngleY='0'/>                                 <RotateTransform Angle='0'/>                                 <TranslateTransform X='0' Y='0'/>                             </TransformGroup>                         </Setter.Value>                     </Setter>                 </Trigger>             </ControlTemplate.Triggers>         </ControlTemplate>          <Style TargetType='{x:Type ListBoxItem}' x:Key='listStyle'>             <Setter Property='Template' Value='{StaticResource listControlTemplate}' />         </Style>     </Window.Resources>     <Window.BindingGroup>         <BindingGroup/>     </Window.BindingGroup>      <Grid x:Name='LayoutRoot' DataContext='{Binding Source={StaticResource dataProvider}, XPath=/Bilder/Bilde}'>         <ListBox ScrollViewer.HorizontalScrollBarVisibility='Hidden'                  ScrollViewer.VerticalScrollBarVisibility='Disabled'                  ItemsSource='{Binding }'                   IsSynchronizedWithCurrentItem='True'                   Background='#FF000000'                  ItemContainerStyle='{StaticResource listStyle}'                   VerticalAlignment='Stretch'                  >             <ListBox.ItemsPanel>                 <ItemsPanelTemplate>                     <VirtualizingStackPanel IsItemsHost='True' Orientation='Horizontal' />                 </ItemsPanelTemplate>             </ListBox.ItemsPanel>         </ListBox>     </Grid> </Window> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:30:50+00:00Added an answer on May 11, 2026 at 7:30 am

    Modify the style for the ListBoxItem to include a setter for the Height property that is bound to the ListBox.ActualHeight property:

        <Style TargetType='{x:Type ListBoxItem}' x:Key='listStyle'>         <Setter Property='Template' Value='{StaticResource listControlTemplate}' />         <Setter Property='Height' Value='{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBox}}, Path=ActualHeight}' />     </Style> 

    This will make your items as tall as their container. From there on, you can bind the Grid in the control template to the ActualHeight of it’s templated parent and size your image. You will have to play a little bit to achieve the height difference. For example, you can create on row above the row with the images and for the selected image change it’s Row and RowSpan properties with a setter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 58k
  • Answers 58k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Do this: SELECT '\\' INTO OUTFILE 'c:/temp/backslash.dump' FIELDS ESCAPED BY… May 11, 2026 at 8:42 am
  • added an answer It's a little like riding a bike, it just takes… May 11, 2026 at 8:42 am
  • added an answer I seemed to have at least one problem with each… May 11, 2026 at 8:42 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.