Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Viewbox does not work in Listbox

$
0
0

Hi all,

Please see my code as below.

The left Viewbox in Grid works well. But the right Viewbox in listbox does not work.

What I want is that when resize window and decrease the height of window, then the ico should become smaller and smaller.

so, how do I make the Viewbox in listbox work?

<GridWidth="200"HorizontalAlignment="Left">
           
<ViewboxStretch="Uniform"MaxHeight="68">
               
<ImageSource="MyIco.ico"MaxHeight="68"/>
           
</Viewbox>
       
</Grid>
       
<ListBoxMargin="200,0,0,0"ItemsSource="{Binding Students}"ScrollViewer.HorizontalScrollBarVisibility="Disabled"ScrollViewer.VerticalScrollBarVisibility="Disabled"VerticalContentAlignment="Stretch">
           
<ListBox.ItemTemplate>
               
<DataTemplate>
                   
<ViewboxStretch="Uniform"MaxHeight="68">
                       
<ImageSource="MyIco.ico"MaxHeight="68"/>
                   
</Viewbox>
               
</DataTemplate>
           
</ListBox.ItemTemplate>
       
</ListBox>


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>