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

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?

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" />

Related

mvvmcross xamarin.forms PictureChooser

I am trying to develop a photo app using the PictureChooser plugin. I see that the sample uses Xamarin.iOS. I've googled for examples where the plugin uses Xamarin.Forms but can't find any. I understand how binding works for labels, text editors, and buttons; however, the binding btw the page's image control and the viewmodel's byte[] has got me stomped.
DAA.UI project:
In CameraPage.XAML:
<Image x:Name="MyImage"
Source="{Binding Bytes, Converter={StaticResource InMemoryImage}}"
Aspect="Fill"
HeightRequest="{OnPlatform iOS=300, Android=250}"
WidthRequest="{OnPlatform iOS=300, Android=250}"
HorizontalOptions="Center" />
In App.XAML:
<?xml version="1.0" encoding="utf-8" ?>
<Application
x:Class="DamageAssessmentApp.UI.App"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="clr-namespace:MvvmCross.Forms;assembly=MvvmCross.Forms"
xmlns:resources="clr-namespace:DAA.UI.Resources"
xmlns:local="using:DAA.UI"
xmlns:nativeValueConverters="using:DAA.UI.NativeValueConverters">
<Application.Resources>
<!-- Application resource dictionary -->
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<resources:Colors />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
<nativeValueConverters:NativeInMemoryImageValueConverter x:Key="InMemoryImage"/>
</Application.Resources>
</Application>
Value Converter file:
using MvvmCross.Forms.Converters;
namespace DAA.UI.NativeValueConverters
{
public class NativeInMemoryImageValueConverter : MvxNativeValueConverter<MvxInMemoryImageValueConverter>
{
}
}
The compiler can't find MvxInMemoryImageValueConverter in the value converter file.
If you are using MVVMCross you should find an example that works with Xamarin.Forms, in which case a good place to start it's their Github.
Or you have to implement it in each platform and use a DependencyService to get the implementation
Other Alternatives
Xamarin Community Toolkit
Another alternative for a camera App is Xamarin Community Toolkit Camera View. In that same link there is an example. But there are more examples in their Github. This is fully compatible with Xamarin.Forms and brings a little more control over the CameraView
Xamarin.Essentials
Xamarin.Essentials offers the MediaPicker that let's the user upload a photo from the gallery or take a new one. But the action of the photo in handled by the OS, so for you it's like a black box. You call the function, and get the photo.

Grails 2.5.0 - Render template in gsp only if the template exists

I'm using a layout where a number of javascript libraries are included at the bottom the file, just above the close of the body tag. What I want to do is add some custom javascript below them on various pages but not all pages. Is there some equivalent of
<g:render template="customjs"/>
I can use in the layout gsp that only renders the template if it exists and does not crash on pages without the _customjs.gsp?
The answer is here https://stackoverflow.com/a/3394720/1790092
If your controller name is "MyJsController"
Consider wrapping this code into a TagLib for better reuse
<g:set var="controller" value="myJs" />
<g:set var="template" value="customjs" />
<g:set var="patternResolver" value="${new org.springframework.core.io.support.PathMatchingResourcePatternResolver()}" />
<g:set var="pathPattern" value="grails-app/views/${controller}/_${template}.gsp" />
<g:if test="${patternResolver.getResources(pathPattern)}">
<g:render template="/${controller}/${template}" />
</g:if><g:else>
not found!
</g:else>

Customize Plone view class without touching the template

If a view is registered like this, with the template definition in zcml:
<browser:page
name="original-view"
class=".original_view.View"
permission="zope2.View"
for="*"
template="original_template.pt"
/>
and i want to customize only his class in my product, is there a way to do it without customizing also the template?
You have to wrap the browser:page by <configure package='XXXX'>
That means your then in scope of this packge.
Example:
<configure package="original.package.browser">
<!-- custom view -->
<browser:page
name="original-view"
class="your.package.browser.View" <!-- Full dotted name to you custom view class -->
permission="zope2.View"
for="*"
layer="your.package.interfaces.IYourPackageLayer" <!-- You should provide a browserlayer, otherwise you got a configuration conflict -->
template="original_template.pt" <!-- template from original.package.browser -->
/>
</configure>
EDIT:
As #sdupton mentioned, I updated the example code snipped with a layer
If you can't use a layer (BrowserLayer) you can put the code, without layer attribute into a overrides.zcml
You can also specify a more precise Interface in the for attribute

How to move the documentactions viewlet from a viewletmanager to another?

Once again back with a Plone question.
I have Plone 4 installed and I need to show the Document action icons at the top instead of bottom. having trouble in getting this to work. can someone help.
If you just need to move that viewlet (with same class and template), first you have to register a viewlet with same class to your desired viewletmanager (let's say for ex. plone.app.layout.viewlets.interfaces.IAboveContentBody):
<browser:viewlet
name="plone.abovecontenttitle.documentactions"
manager="plone.app.layout.viewlets.interfaces.IAboveContentBody"
class="plone.app.layout.viewlets.content.DocumentActionsViewlet"
permission="zope2.View"
/>
and then add this in your genericsetup profile (file viewlets.xml) :
<?xml version="1.0"?>
<object>
<order manager="plone.abovecontentbody" skinname="Plone Default">
<!-- this will place your viewlet before all the others.
you can also use a viewlet's name for a relative position -->
<viewlet name="plone.abovecontenttitle.documentactions" insert-before="*"/>
</order>
<hidden manager="plone.belowcontentbody" skinname="Plone Default">
<viewlet name="plone.abovecontenttitle.documentactions"/>
</hidden>
</object>
More info:
http://plone.org/documentation/kb/customization-for-developers/viewlets
http://collective-docs.readthedocs.org/en/latest/views/viewlets.html

Internationalizing an mx:MenuBar?

Well, I was able to simply enough (after about an hour of googling) implement i18n (internationalization) into my Flex application by having to reverse engineer the Flex SDK and do a lot of digging (a specific question on here helped me a lot! (with some updates for flex 4.5)).
The problem is, I can't use my {getLand('key')} bind inside an <fx:XMLList> (how you define the contents of a <mx:MenuBar>. I've included some example i18n below, as well as an example of the menu bar.
<!-- Example of proper (working) i18n -->
<s:TextArea text="{getLang('Rules')}"/>
<!-- Problem Area (a bare bones example) -->
<!-- Error message in IDE: Access of undefined property _application_XMLList1 -->
<mx:MenuBar labelField="#label">
<fx:XMLList>
<menuitem label="{getLang('File')}"/>
</fx:XMLList>
</mx:MenuBar>
Try putting the XMLList outside of the menubar, like so:
<fx:Declarations>
<fx:XMLList id="_menuStuff">
<menuitem label="{getLang('File')}"/>
</fx:XMLList>
</fx:Declarations>
<mx:MenuBar labelField="#label" dataProvider="{_menuStuff}"/>
That should work, good luck!

Resources