Click here to Skip to main content
15,886,567 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two Usercontrols say "Usercntrl1" and "Usercntrl2", "Usercntrl1" contains **Slider**, "Usercntr2" has **ListBox with Images**, Now when i change the Slider value in "Usercntrl1" ,
the ListboxItems size(i.e,) Width and Height has to change with Respect to Slider value

It can be easily done when both of them present in same usercontrol as follows

XML
<ListBox.ItemContainerStyle>
                    <Style TargetType="{x:Type ListBoxItem}">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                        <Setter Property="Padding" Value="0"/>
                        <Setter Property="Margin" Value="1"/>
                        <Setter Property="BorderBrush" Value="Green"/>
                        <Setter Property="Width" Value="{Binding Path=Value, ElementName=sizeSlider, Mode=TwoWay}"/>
                        <Setter Property="Height" Value="{Binding Path=Value, ElementName=sizeSlider, Mode=TwoWay}"/>
                         <Setter Property="TabIndex" Value="1"/>
                                           </Style>
                </ListBox.ItemContainerStyle>


could anybody guide over this
Posted

1 solution

 
Share this answer
 
v2
Comments
kumar.selva.c 11-Jul-13 6:58am    
@Naz_Firdouse, thanx for ur reply, but its a work around way so i did it simply by Registering dependencyproperty in both usercntrol, please see this [http://stackoverflow.com/questions/17570070/how-to-change-listboxitem-size-with-respect-to-slider-value]
Naz_Firdouse 11-Jul-13 7:04am    
Thanks for sharing...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900