enisn / UraniumUI

Uranium is a Free & Open-Source UI Kit for MAUI.
Apache License 2.0
1.17k stars 142 forks source link

the Uranium toolkit not working for me. #420

Closed keringKirwa closed 4 months ago

keringKirwa commented 1 year ago

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: Unable to find IAnimationManager for 'Microsoft.Maui.Controls.BoxView'. (Parameter 'animatable') at Microsoft.Maui.Controls.ViewExtensions.GetAnimationManager(IAnimatable animatable)

am getting this error anytime i try using the uraniumUI package , what is the problem ? is uraniumUI a package just like the other packages or i have to start a uraniumUI project using your own commands.Thanks.

enisn commented 1 year ago

Hi @keringKirwa

Can you provide more information about it?

As I understand your project isn't compiling right? Is it the compiler error or runtime exception?

Eronan commented 10 months ago

Hello, I'm not the OP but I have received the same error. I'll provide my details:

The error is a runtime error for me that happens after trying to dynamically add a TabItem to the Items property of the TabView. I am building a CollectionView and Frame that is added to an TabItem. At the moment the TabItem is added to the TabView, it gives the above error.

EDIT: I found the fix to my issue, following the this issue on the NET Maui repository. The items need to be rendered after it's been loaded. So you'll need to set any details after the LoadAsync method.

sakuk005 commented 9 months ago

@enisn This is still an issue on UraniumUI.Material 2.7.4 on .NET 8 on Windows 10.0.22621.2428 (WinAppSDK 1.4.231219000) using an otherwise empty project.

Suggested new title for this issue: TabView controls throw internal MAUI exception if added before first window is rendered on WinUI

System.ArgumentException: Unable to find IAnimationManager for 'Microsoft.Maui.Controls.BoxView'. (Parameter 'animatable')
   at Microsoft.Maui.Controls.ViewExtensions.GetAnimationManager(IAnimatable animatable) in Microsoft.Maui.Controls\ViewExtensions.cs:line 228
   at Microsoft.Maui.Controls.AnimationExtensions.Animate[T](IAnimatable self, String name, Func`2 transform, Action`1 callback, UInt32 rate, UInt32 length, Easing easing, Action`2 finished, Func`1 repeat, IAnimationManager animationManager) in Microsoft.Maui.Controls\AnimationExtensions.cs:line 162
   at Microsoft.Maui.Controls.AnimationExtensions.Animate(IAnimatable self, String name, Action`1 callback, UInt32 rate, UInt32 length, Easing easing, Action`2 finished, Func`1 repeat) in Microsoft.Maui.Controls\AnimationExtensions.cs:line 143
   at Microsoft.Maui.Controls.AnimationExtensions.Animate(IAnimatable self, String name, Animation animation, UInt32 rate, UInt32 length, Easing easing, Action`2 finished, Func`1 repeat) in Microsoft.Maui.Controls\AnimationExtensions.cs:line 121
   at Microsoft.Maui.Controls.Animation.Commit(IAnimatable owner, String name, UInt32 rate, UInt32 length, Easing easing, Action`2 finished, Func`1 repeat) in Microsoft.Maui.Controls\Animation.cs:line 49
   at Microsoft.Maui.Controls.ViewExtensions.AnimateTo(VisualElement view, Double start, Double end, String name, Action`2 updateAction, UInt32 length, Easing easing) in Microsoft.Maui.Controls\ViewExtensions.cs:line 40
   at Microsoft.Maui.Controls.ViewExtensions.FadeTo(VisualElement view, Double opacity, UInt32 length, Easing easing) in Microsoft.Maui.Controls\ViewExtensions.cs:line 60
   at UraniumUI.Material.Controls.TabView.<>c.<get_DefaultTabHeaderItemTemplate>b__41_4(Grid sender)
   at UraniumUI.Triggers.GenericTriggerAction`1.Invoke(T sender)
   at Microsoft.Maui.Controls.TriggerAction`1.Invoke(Object sender) in Microsoft.Maui.Controls\TriggerAction.cs:line 34
   at Microsoft.Maui.Controls.TriggerAction.DoInvoke(Object sender) in Microsoft.Maui.Controls\TriggerAction.cs:line 22
   at Microsoft.Maui.Controls.TriggerBase.OnConditionChanged(BindableObject bindable, Boolean oldValue, Boolean newValue) in Microsoft.Maui.Controls\TriggerBase.cs:line 237
   at Microsoft.Maui.Controls.BindingCondition.OnBoundPropertyChanged(BindableObject bindable, Object oldValue, Object newValue) in Microsoft.Maui.Controls\BindingCondition.cs:line 111
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindingExpression.ApplyCore(Object sourceObject, BindableObject target, BindableProperty property, Boolean fromTarget, SetterSpecificity specificity) in Microsoft.Maui.Controls\BindingExpression.cs:line 350
   at Microsoft.Maui.Controls.BindingExpression.Apply(Object sourceObject, BindableObject target, BindableProperty property, SetterSpecificity specificity) in Microsoft.Maui.Controls\BindingExpression.cs:line 283
   at Microsoft.Maui.Controls.Binding.Apply(Object context, BindableObject bindObj, BindableProperty targetProperty, Boolean fromBindingContextChanged, SetterSpecificity specificity) in Microsoft.Maui.Controls\Binding.cs:line 149
   at Microsoft.Maui.Controls.BindableObject.ApplyBindings(Boolean skipBindingContext, Boolean fromBindingContextChanged)
   at Microsoft.Maui.Controls.BindableObject.BindingContextPropertyChanged(BindableObject bindable, Object oldvalue, Object newvalue)
   at Microsoft.Maui.Controls.BindableObject.SetValueActual(BindableProperty property, BindablePropertyContext context, Object value, Boolean currentlyApplying, SetValueFlags attributes, SetterSpecificity specificity, Boolean silent)
   at Microsoft.Maui.Controls.BindableObject.SetValueCore(BindableProperty property, Object value, SetValueFlags attributes, SetValuePrivateFlags privateAttributes, SetterSpecificity specificity)
   at Microsoft.Maui.Controls.BindableObject.SetValue(BindableProperty property, Object value)
   at Microsoft.Maui.Controls.BindableObject.set_BindingContext(Object value)
   at UraniumUI.Material.Controls.TabView.AddHeaderFor(TabItem tabItem)
   at UraniumUI.Material.Controls.TabView.Items_CollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
   at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 178

Called with:

<?xml version="1.0" encoding="utf-8"?>
<Page
  xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
  xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
  xmlns:m="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material"
  x:Class="TestApp.TestPage">
  <Grid>
    <m:TabView>
      <m:TabItem Title="Test" />
      <m:TabItem Title="Test2" />
    </m:TabView>
  </Grid>
</Page>

And the contents of MauiProgram.CreateMauiApp():

public static MauiApp CreateMauiApp()
{
  var builder = MauiApp.CreateBuilder();
  builder
    .UseMauiApp<App>()
    .UseMauiCommunityToolkit()
    .UseUraniumUI()
    .UseUraniumUIMaterial();
  return builder.Build();
}

App.xaml:

<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:m="http://schemas.enisn-projects.io/dotnet/maui/uraniumui/material"
             x:Class="TestApp.App">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <m:ColorResource />
                <m:StyleResource />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>