ActualWidth used in converter is 0 instead of actual width
Hi,
This was working fine with 3.0.10, but seems broken with 3.1.2. The code works also fine in Blend, so I assume this is a bug in Noesis introduced between 3.0.10 and now.
I have some decorator used to later get the width of some elements.
Then binding to 'ActualWidth' with a converter to get the negative value, to move the object to the left of the screen. When I put a breakpoint in the Convert method of the converter, the received value is 0.
I would love to find a workaround until this gets fixed, else I'll have to revert to 3.0.xx
Thanks
This was working fine with 3.0.10, but seems broken with 3.1.2. The code works also fine in Blend, so I assume this is a bug in Noesis introduced between 3.0.10 and now.
I have some decorator used to later get the width of some elements.
Code: Select all
<Decorator Grid.ColumnSpan="5" x:Name="RefWidth"></Decorator>
Code: Select all
<Grid.Resources>
<Storyboard x:Key="StoryBoardEmailInfo">
<DoubleAnimation Storyboard.TargetName="GridCreateAccount"
Storyboard.TargetProperty="RenderTransform.(TranslateTransform.X)"
To="{Binding ActualWidth, ElementName=RefWidth, Converter={StaticResource NegativeConverter}}" Duration="0:0:0.5">
<DoubleAnimation.EasingFunction>
<PowerEase EasingMode="EaseIn"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</Grid.Resources>
Thanks
-
-
sfernandez
Site Admin
- Posts: 2783
- Joined:
Re: ActualWidth used in converter is 0 instead of actual width
Could you please report this issue in our bugtracker?
In the meantime, it should work if you wrap the resources inside a ResourceDictionary node like this:
In the meantime, it should work if you wrap the resources inside a ResourceDictionary node like this:
Code: Select all
<Grid.Resources>
<ResourceDictionary>
<Storyboard x:Key="StoryBoardEmailInfo">
<DoubleAnimation Storyboard.TargetName="GridCreateAccount"
Storyboard.TargetProperty="RenderTransform.(TranslateTransform.X)"
To="{Binding ActualWidth, ElementName=RefWidth, Converter={StaticResource NegativeConverter}}" Duration="0:0:0.5">
<DoubleAnimation.EasingFunction>
<PowerEase EasingMode="EaseIn"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</ResourceDictionary>
</Grid.Resources>
Re: ActualWidth used in converter is 0 instead of actual width
I wrapped into a <ResourceDictionary>, but this still doens't work.
Re: ActualWidth used in converter is 0 instead of actual width
My bad, the converters used in the previous excerpt do work fine, breakpoint placed in the converter code shows 2 calls, one with 0, then one with the actual width. I have multiple use cases on the same xaml page and mistaken some. The code not working is when used in Triggers, where it doesn't reach the breakpoint placed in the converter at all.
Code: Select all
<Grid.Triggers>
<EventTrigger SourceName="BtnAnonymous" RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard x:Name="StoryBoard0">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="GridSigninButtons"
Storyboard.TargetProperty="RenderTransform.(TranslateTransform.X)"
To="{Binding ActualWidth, ElementName=RefWidth, Converter={StaticResource NegativeConverter}}" Duration="0:0:0.5">
<DoubleAnimation.EasingFunction>
<PowerEase EasingMode="EaseIn"/>
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Grid.Triggers>
Re: ActualWidth used in converter is 0 instead of actual width
Ok, what worked was to move the Storyboard definition from the EventTrigger to the <Grid.Resources> AND to wrap into <ResourceDictionary>.
-
-
sfernandez
Site Admin
- Posts: 2783
- Joined:
Re: ActualWidth used in converter is 0 instead of actual width
Added ticket #2234 to solve this issue.
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest