J
JohnGlen244
Guest
This works for making a square button:
Height = "{Binding Path=ActualWidth, RelativeSource={RelativeSource Self}}"
I would like a aspect ratio of 1 to 5 though. Something like this:
Height = "{Binding Path=ActualWidth/5.0, RelativeSource={RelativeSource Self}}"
That does not compile though.
I have attempted to use c# to make a square button:
Button button = (Button)FindName("ButtonStart");
var myBinding = new Binding("Height")
{
Source = button.ActualWidth
};
button.SetBinding(Button.HeightProperty, myBinding);
This doesn't make the button square.
Is it possible to set the aspect ratio of a button using data binding?
Continue reading...
Height = "{Binding Path=ActualWidth, RelativeSource={RelativeSource Self}}"
I would like a aspect ratio of 1 to 5 though. Something like this:
Height = "{Binding Path=ActualWidth/5.0, RelativeSource={RelativeSource Self}}"
That does not compile though.
I have attempted to use c# to make a square button:
Button button = (Button)FindName("ButtonStart");
var myBinding = new Binding("Height")
{
Source = button.ActualWidth
};
button.SetBinding(Button.HeightProperty, myBinding);
This doesn't make the button square.
Is it possible to set the aspect ratio of a button using data binding?
Continue reading...