Hi, I am having problems with binding into grid's columndefinition width proprety.
I tried TestWidth.Value as well as just double and string.
Any idea whats the problem?
`<ColumnDefinition Width="{Binding Parent.SizeModifier.TestWidth, Source={x:Reference Self}}"></ColumnDefinition>`
class SizeModifier
{
public int DefaultWindowWidth { get; set; }
public int DefaultWindowHeight { get; set; }
public int DefaultWindowDPI { get; set; }
public double WidthModifier { get; set; }
public double HeightModifier { get; set; }
public double DPIModifier { get; set; }
public int DeviceWidth { get; set; }
public int DeviceHeight { get; set; }
public int DeviceDPI { get; set; }
public GridLength TestWidth { get; set; }
public string Test = "400";
public SizeModifier()
{
DefaultWindowWidth = 1280;
DefaultWindowHeight = 800;
DefaultWindowDPI = 160;
DeviceDPI = DependencyService.Get<IGetScreenSizes>().GetDisplayDpi();
DeviceWidth = DependencyService.Get<IGetScreenSizes>().GetDisplayWidth();
DeviceHeight = DependencyService.Get<IGetScreenSizes>().GetDisplayHeight();
DPIModifier = (double)DeviceDPI / (double)DefaultWindowDPI;
WidthModifier = (double)DeviceWidth / (double)DefaultWindowWidth*DPIModifier;
HeightModifier = (double)DeviceHeight / (double)DefaultWindowHeight*DPIModifier;
TestWidth = new GridLength((double)400 * WidthModifier, GridUnitType.Absolute);
}
}
}