-
- jpattersonCSpeed
- Posts: 7
- Joined:
Binding Multiple Values to a Margin
Hello again,
I am trying to apply a margin to an element that will eventually have bindings to make certain sides of the margin change based on calculations. In WPF, this is achieved through the following link under "XAML Property Element Usage":
https://docs.microsoft.com/en-us/dotnet ... ment-usage
A quick demo app in WPF with a TextBlock confirms that this works as described:
The same code inside of Noesis doesn't produce the same results, and running it in the XAMLtoy app produces errors stating "Can't assign property to abstract class 'Thickness'." Since this is different behavior from WPF is this considered a bug? If it is not a bug, is there a different workflow that produces the same results?
Thanks.
I am trying to apply a margin to an element that will eventually have bindings to make certain sides of the margin change based on calculations. In WPF, this is achieved through the following link under "XAML Property Element Usage":
https://docs.microsoft.com/en-us/dotnet ... ment-usage
A quick demo app in WPF with a TextBlock confirms that this works as described:
Code: Select all
<TextBlock Text="Some Text">
<TextBlock.Margin>
<Thickness Left="100" Top="100" Bottom="0" Right="0"/>
</TextBlock.Margin>
</TextBlock>
Thanks.
-
-
sfernandez
Site Admin
- Posts: 2056
- Joined:
Re: Binding Multiple Values to a Margin
In WPF you can specify a Thickness value using their individual properties (we don't support this in Noesis), but you won't be able to use bindings to set those properties:
This will throw the error: "A 'Binding' cannot be set on the 'Left' property of type 'Thickness'. A 'Binding' can only be set on a DependencyProperty of a DependencyObject".
Struct properties should be set as a whole object via bindings:
Code: Select all
<TextBlock Text="Some Text">
<TextBlock.Margin>
<Thickness Left="{Binding LeftMargin}" Top="100" Bottom="0" Right="0"/>
</TextBlock.Margin>
</TextBlock>
Struct properties should be set as a whole object via bindings:
Code: Select all
<TextBlock Text="Some Text" Margin="{Binding TextMargin}"/>
-
- jpattersonCSpeed
- Posts: 7
- Joined:
Re: Binding Multiple Values to a Margin
Ah I would have thought that the binding would have worked. No worries, this is a hint that I have to change up the area of the UI that was going to use this to be something better. Thanks.
Who is online
Users browsing this forum: No registered users and 0 guests