前提・実現したいこと
Xamarin.Formsを使ったモバイルアプリを作成中です。
UIをアニメーションさせたいと思い実装を行っているのですがうまく動きません。
XAML内でEnterActionとExitActionでのアニメーションを実行しようとしています。
以下の公式サンプルを参考に実装しました。
EnterActions and ExitActions
上記サンプルはBackgroundColorの変更ですが、実際に行いたいことはLabelのFontSizeとTextColorのアニメーションによる変更です。
また、上記サンプルはTriggerですが、実際にはDataTriggerを使ってアニメーションを開始させたいと考えています。
発生している問題・エラーメッセージ
Unhandled Exception: System.ArgumentException: Argument is null or empty Parameter name: handle at Xamarin.Forms.AnimatableKey..ctor (Xamarin.Forms.IAnimatable animatable, System.String handle) [0x0001c] in D:\a\1\s\Xamarin.Forms.Core\AnimatableKey.cs:16 at Xamarin.Forms.AnimationExtensions.AnimateInternal[T] (Xamarin.Forms.IAnimatable self, System.String name, System.Func`2[T,TResult] transform, System.Action`1[T] callback, System.UInt32 rate, System.UInt32 length, Xamarin.Forms.Easing easing, System.Action`2[T1,T2] finished, System.Func`1[TResult] repeat) [0x0001c] in D:\a\1\s\Xamarin.Forms.Core\AnimationExtensions.cs:180 (中略) ================================================================= Got a SIGABRT while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application. =================================================================```
該当のソースコード
以下にサンプルコードを置いています。
MainPageは以下の通りです。
XAML
1<StackLayout> 2 <Entry Placeholder="test"> 3 <Entry.Triggers> 4 <Trigger TargetType="Entry" Property="Entry.IsFocused" Value="True"> 5 <Trigger.EnterActions> 6 <trigger:ChangeBackgroundColorTriggerAction StartsFrom="0"/> 7 </Trigger.EnterActions> 8 <Trigger.ExitActions> 9 <trigger:ChangeBackgroundColorTriggerAction StartsFrom="1"/> 10 </Trigger.ExitActions> 11 </Trigger> 12 </Entry.Triggers> 13 </Entry> 14 <Label Text="Welcome to Xamarin.Forms!" HorizontalOptions="Center" VerticalOptions="CenterAndExpand" > 15 <Label.Triggers> 16 <DataTrigger TargetType="Label" Binding="{Binding Path=m_IsChangeBackgroundColorAminationStart}" Value="true"> 17 <DataTrigger.EnterActions> 18 <trigger:ChangeBackgroundColorTriggerAction StartsFrom="0"/> 19 </DataTrigger.EnterActions> 20 <DataTrigger.ExitActions> 21 <trigger:ChangeBackgroundColorTriggerAction StartsFrom="1"/> 22 </DataTrigger.ExitActions> 23 </DataTrigger> 24 <DataTrigger TargetType="Label" Binding="{Binding Path=m_IsChangeFontSizeAnimationStart}" Value="true"> 25 <DataTrigger.EnterActions> 26 <trigger:LabelFontSizeTriggerAction FontSize="10"/> 27 </DataTrigger.EnterActions> 28 <DataTrigger.ExitActions> 29 <trigger:LabelFontSizeTriggerAction FontSize="40"/> 30 </DataTrigger.ExitActions> 31 </DataTrigger> 32 </Label.Triggers> 33 </Label> 34 <Button Command="{Binding StartChangeBackgroundColorAnimationCommand}" Text="Change BackgroundColor"/> 35 <Button Command="{Binding StartChangeFontSizeAnimationCommand}" Text="Change FontSize"/> 36</StackLayout>
試したこと
TriggerとDataTriggerの両方で試しましたがどちらも同じエラーでした。
補足情報(FW/ツールのバージョンなど)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/09/21 09:24