Click here to Skip to main content
15,906,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have a slider and a grid(child grid) inside a "Main grid".(the "Main grid" has 2 rows and in each row i have added the slider and grid)
1 - i want to bind the minimum of the slider to the "Main grid"'s width.
2 - i want to bind the child grid's width to the sliders value.
3 - i want to do them programmatically and not with xaml.

i have asked a binding question before but it didn't work(binding the sliders minimum to the "Main grid"'s width).
here's the code :
Grid Maingrid = new Grid();
Slider s1 = new Slider();

Binding minWidthBinding = new Binding();
minWidthBinding.Path = new PropertyPath(Grid.ActualWidthProperty);
minWidthBinding.ElementName = "Maingrid";
BindingOperations.SetBinding(s1, Slider.ValueProperty, minWidthBinding);


Actually i am making a kind of zoom in the width of the grid by using the slider.
Sorry for my long questions:D
Thanks
Posted

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