Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

some one please help me.

XML
<zb:ZoomBoxPanel ZoomMode="FitPage" x:Name="zoomBox" Grid.Row="2" MinZoom="20" MaxZoom="300" MouseMode="Pan" WheelMode="Zoom">
         <Border BorderThickness="1" BorderBrush="Black">
             <Button Width="100" Height="200" HorizontalAlignment="Left" VerticalAlignment="Top"></Button>
         </Border>
     </zb:ZoomBoxPanel>


     <zb:ZoomBoxSlider Margin="10" Grid.Row="2" Grid.Column="0"
               HorizontalAlignment="Right" VerticalAlignment="Top"
               ZoomBox="{Binding ElementName=zoomBox}" />



the above code works fine as the both ZoomBoxPanel and ZoomBoxSlider are in same window.

but if i create one UserControl where i am going to place the ZoomBoxPanel and now the created UserControl and the ZoomBoxSlider are in same window now how can i bind the zoombox property of the ZoomBoxSlider with the ZoomBoxPanel control of the created UserControl

Thanks and regards
Easwar
Posted
Updated 12-Jun-12 21:07pm
v3
Comments
Sandeep Mewara 13-Jun-12 1:52am    
Not clear on what is the issue with whatever you are trying to do. BTW, looks like a 3rd party control ZoomBoxSlider - did you look at how it is used?
koteswararao_m 13-Jun-12 2:08am    
Hi Sandeep.

Thanks for your response. zoomboxslider is a third party control. here my doubt is not about the control. its about how to bind. as given in the above line, i want to bind the depencency property(zoombox-property) of a zoolslider-control with the child control of imageviewer.(zoombox-control is a sub control in imageviewer).


normally if both zoomslider and zoombox are in same window then <zoomboxslider zoombox="{Binding ElementName=zoomBox}"> is working fine . but if the zoomBox control is in another usercontrol placed in window then how to bind that with the dependency property of the zoom slider

1 solution

You can add a property that holds the ZoomBoxPanel to your UserControl:


C#
public class MyUserControl : UserControl
{
    ...

    public ZoomBoxPanel MyZoomBox
    {
        get { return zoomBox; }
    }
    
    ...
}

and, use this property for the binding:


XML
<local:MyUserControl x:Name="myUc" ... />

<zb:ZoomBoxSlider Margin="10" Grid.Row="2" Grid.Column="0"
HorizontalAlignment="Right" VerticalAlignment="Top"
ZoomBox="{Binding ElementName=myUc, Path=MyZoomBox}" /> 
 
Share this answer
 
v4

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