uno-platform

uno.toolkit.ui: how to use Card or Divider control on Skia.Gtk platorm


I try to use Divider and Card control from the uno.toolkit.ui package:

<utu:Divider SubHeader="Uno.Material Controls:" 
            Style="{StaticResource MaterialDividerStyle}" />

<utu:Card HeaderContent="Header Outlined card With supporting text"
            SubHeaderContent="With supporting text"
            SupportingContent="This is the supporting text"
            Style="{StaticResource MaterialOutlinedCardStyle}" />

when I run the sample, I get a lot of messages like:

warn: Uno.UI.ResourceResolver[0]
      Couldn't statically resolve resource MaterialOutlinedCardContentControlStyle

warn: Uno.UI.ResourceResolver[0]
      Couldn't statically resolve resource MaterialDividerStyle

warn: Uno.UI.ResourceResolver[0]

and the Controls are not displayed. Using the TabBar - Control from the Toolkit works.

Any idea what is going wrong?


Solution

  • Make sure to follow instructions as described in the README page on the uno.toolkit.ui repo...

    Since the reference to the missing style (MaterialDividerStyle for the <Divider> control) is defined in the MaterialToolkitResources dictionary, you need to add a reference to it in your App.xaml file, like that:

    <!-- App.xaml: -->
    
        <!--  Load Uno.UI.Toolkit resources  -->
        <ToolkitResources xmlns="using:Uno.Toolkit.UI" />
    
        <!--  Load Material resources  -->
        <MaterialColors xmlns="using:Uno.Material" />
        <MaterialResources xmlns="using:Uno.Material" />
    
        <!--  Load Material Toolkit resources  -->
        <MaterialToolkitResources xmlns="using:Uno.Toolkit.UI.Material" />