Giter Site home page Giter Site logo

xfgloss's People

Contributors

kyle-seongwoo-jun avatar tbaggett avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xfgloss's Issues

Possible bug with iOS 10+

Hi Tom,

Firstly, fantastic control. I'm planning on using it, but wanted to run something by you before I commit.

While searching for a gradient XF control, I stumbled across the XFLabs Gradient control as well as XFGloss. I fired up the XFLabs version first and notice straight away that it's inferior (supports only two colors to XFGloss, but more importantly, with regards to iOS, I noticed that neither XFLabs or XFGloss work on an iPad Mini 4 running OS 10.2.1. (actual device, not simulator). The gradient does not show, only a white background.

Dug some more which turned up this stackoverflow post:
http://stackoverflow.com/questions/37170276/xamarin-forms-gradient-background-for-button-using-custom-renderer-with-ios

According to that post, it states, "If you are using iOS 10+ with newer version of Xamarin.Forms, the Control.Bounds during calls to LayoutSubViews will all be zeros. You will need to set the gradient layer Frame size during sets to the control's Frame property". Follows up with a code example...

I modified the XFLabs code to match the stackoverflow code sample and it fixes the issue. Ideally I'd rather use XFGloss cause it supports Steps.

Anyway, I thought you'd like to know and possibly give this a try with a device running iOS 10+.

thoughts?

[EDIT]
Ugh! While the XFLabs was a legitimate fix, I'm embarrassed to admit, I left out the Init() in the AppDelegate when testing out XFGLoss. Please close this issue for me.
Sorry for any confusion.

Android X support

Hi and thanks for a great component.

Building with the latest version of Xamarin.Forms for Android gives the following error:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Error XA2002: Can not resolve reference: Xamarin.Android.Support.v7.AppCompat, referenced by XFGloss. Please add a NuGet package or assembly reference for Xamarin.Android.Support.v7.AppCompat, or remove the reference to XFGloss. (XA2002) (MyApp.Android)

Do you think the library could be updated with proper Android X support?

Thanks!

Type xfg:ContentPageGloss.BackgroundGradient not found

I'm following the example on the example project, but when I try to compile I get the error that xfg:ContentPageGloss.BackgroundGradient not found in xmlns car-namespace:XFGloss;assembly=XFGloss

My full xaml page is

I have XFGloss initialised in both the Android and iOS projects with the target framework set to .NET Standard 2.

I don't have a problem if I'm writing code rather than xaml

Failed to register the needed AppCompat version of the XFGloss custom renderers

Hi! First of all you have an awesome project ongoing!

Tried to implement XFGloss in my current project with these properties:

  • Target = Android 7.1 (API level 25)
  • Xamarin.Forms = v2.3.5.239-pre3
  • XFGloss = v1.0.6.59

Called Init() after LoadAplication() like this:

public class MainActivity : FormsAppCompatActivity
{
      protected override void OnCreate(Bundle savedInstanceState)
     {
           ...
           Forms.Init(this, savedInstanceState);
           ...
           LoadAplication(new App());

           //XFGloss Call
           XFGloss.Droid.Library.Init(this, savedInstanceState);
     }
}

But I get this error:

System.InvalidOperationException:

XFGloss.Droid.Library.Init(...) failed to register the needed AppCompat version of the XFGloss custom renderers. Please report an issue at https://github.com/tbaggett/xfgloss.
at XFGloss.Droid.Library.RegisterAppCompatRenderers () [0x00081] in <954620044cfa49a0ab8663158f33db77>:0
at XFGloss.Droid.Library.Init (Android.Content.Context context, Android.OS.Bundle bundle) [0x0001f] in <954620044cfa49a0ab8663158f33db77>:0
at MyApp.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0014d] in /Users/me/Projects/MyApp/Droid/Activities/MainActivity.cs:92
at Android.Support.V4.App.FragmentActivity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x00011] in <7e083afc7c9045f59e01d9c14931060d>:0
at at (wrapper dynamic-method) System.Object:28916aee-0aa7-4db0-90a4-e61bc00c845d (intptr,intptr,intptr)

Any resolution?

Add Gradient to Text Color?

Hi,
Can it add/change Text Color Property of Entry/Button/etc to also have gradient?
I see here only BackgroundGradient. Can you add it please?
I know it can be done on Android:
Text Color Gradient , but i'm looking for Cross Platform solution.
Thanks for your great work!

[Question] Possible to use a second custom renderer ontop of XFG?

I spent a while debugging why a new SwitchCellRenderer wasn't working and have discovered that it was because XFG has registered its own (I wasn't using it for the SwitchCells and wasn't aware it affected them).

Now that I'm aware that I, if anything, should be creating a subclass of XFGlossSwitchCellRenderer, how about do I go applying it to SwitchCells? Is there any way I can tell XFG to use a new subclass of XFGlossSwitchCellRenderer rather than the default XFGlossSwitchCellRenderer?

I'm just looking to tweak something subtle about SwitchCells (padding, nothing too crazy).

Thanks!

I am creating a new renderer as such:

public class PCLSwitchCellRenderer : XFGlossSwitchCellRenderer
    {
        public override UITableViewCell GetCell(Cell item, UITableViewCell reusableCell, UITableView tv)
        {
            UITableViewCell cell = base.GetCell(item, reusableCell, tv);
            if (cell != null)
            {
                // tweak my switchcell here...
                cell.TextLabel.Text = "test test test";
            }

            return cell;
        }
    }

XFGloss Gradient not working in Release mode for iOS with "Link SDK Assemblies only"

I have tried every manner of configuration I could think of to get this working. I'm only using a Gradient with ContentPageGloss.BackgroundGradient in XAML, but it refuses to render in Release mode with iOS "Linker Behavior" set to "Link SDK Assemblies only". I have tried all of the following, to no avail:

  1. Standard XFGloss.iOS.Library.Init() call in AppDelegate
  2. Reference Gradient and ContentPageGloss classes in preservation class (Similar to how Akavache suggests here).
  3. mtouch arguments --linkskip=XFGloss --linkskip=XFGloss.iOS

Any ideas?

Support UWP

If you're making a library for XF, you need/should support all the platforms it supports.

Page renderer

I have a custom renderer targeting the Page on iOS.
If I add the XFGloss renderer, my renderer stop working. Looks like it isn't fired any more.

Is it normal?
Can I use my custom renderer together with the XFGloss?

ListView ContextMenu Active ViewCell Color

This is mainly for Android, but can probably be translated to other platforms as well.

If I add xfGloss:CellGloss.BackgroundColor="White" to a ViewCell, I get the benefit of having a different color background from the parent ListView, however I lose the selected color when I long-press the view cell in order to bring up the Android ContextMenu.

Is there any way to set the background color AND have a separate color when the context menu is active?

I can see this being useful on iOS too, however it's more likely that the background will stay the same color when the view cell is swiped to reveal the context menu.

Proposed API

xfGloss:CellGloss.ContextMenuActiveBackgroundColor="#xxx"

And this color would be set for the active view cell when the Context Menu is open.

note: I'm not actually sure what the name should be, color states on Android are a pita

Why .netstandard 2.0?

I use a main Core project that targets netstandard 1.4 as there is a UWP dependency that builds for Anniversary Update. Any chance of dropping the level down as I can't see any use for 2.0 in the code yet?

Thanks

Xamarin.iOS: Unable to locate assembly 'XFGloss' (culture: '')

I get this error and the app crash.

Xamarin.iOS: Unable to locate assembly 'XFGloss' (culture: '')
Why?

The xaml file:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
			 xmlns:maps="clr-namespace:Xamarin.Forms.GoogleMaps;assembly=Xamarin.Forms.GoogleMaps"
             xmlns:xfg="clr-namespace:XFGloss;assembly=XFGloss"
             x:Class="ApliPur.SeleccionarRecintePage"
             Title="Recintes">
	<StackLayout>
		<maps:Map x:Name="mapaRecintes"/>
    <ListView x:Name="llistaRecintes" ItemSelected="escollirRecinte">
      <ListView.ItemTemplate>
        <DataTemplate>
          <ViewCell xfg:CellGloss.BackgroundColor="{Binding color}">
            <StackLayout Margin="20,0,0,0" Orientation="Horizontal" HorizontalOptions="FillAndExpand" Style="{StaticResource TextLlista}">
                <Label Text="{Binding nomApp}" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" Style="{StaticResource TextLlista}"/>
                <Label Text="{Binding stringDistancia}" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" Style="{StaticResource TextLlista}"/>
                <Label Text="{Binding hectarees}" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" Style="{StaticResource TextLlista}"/>
                <Label Text="{Binding nitrogenPerTirar}" VerticalTextAlignment="Center" HorizontalOptions="StartAndExpand" Style="{StaticResource TextLlista}"/>     
		    </StackLayout>
		  </ViewCell>
        </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>

  </StackLayout>
  
</ContentPage>

Grid

Hi,

Is it possible to add gradient to an entire grid?

Thanks!

Gradient does not work with AppShell

A curious one. I have a new Xamarin Forms app and it starts with a welcome page that uses XFGloss for diagonal gradients. After the Welcome screen is uses the Xamarin AppShell for the main part. The Android project works fine, Welcome page with gradient then AppShell pages. With iOS however the Welcome page works but the AppShell has a black background, nothing showing. What makes it curious is that just removing the code from the Welcome page that creates the background solves the issue and I get the AppShell again. If I bypass the Welcome page and go straight to the AppShell it still fails as long as I have the gradient code included. I've included a sample which demonstrates the issue. Note that this is in the iPhoneSimulator, so it is possible that it may work on an iOS device but it makes dev work problematic.
TestAppShell.zip

XFGloss Background Gradient Fails on iOS with Xamarin.Forms V16.8.0

XFGloss does not seem to be able to set the colour of the iOS navigation bar since I updated Xamarin.Forms to V16.8.0.

The following is an abbreviated way that I set a background gradient on my screens:

public abstract class ViewBase : ContentPage
{
	private XFGloss.Gradient GradientBackground = new XFGloss.Gradient()
	{
		Rotation = 0,
		Steps = new XFGloss.GradientStepCollection()
		{
			new XFGloss.GradientStep( Color.FromHex( "#888888"), 0.0 ),
			new XFGloss.GradientStep( Color.FromHex( "#777777"), 0.15),
			new XFGloss.GradientStep( Color.FromHex( "#666666"), 0.6 ),
			new XFGloss.GradientStep( Color.FromHex( "#555555"), 0.9 ),
			}
		};

	public ViewBase()
	{
		BackgroundColor = Colours.MainBackground;
		XFGloss.ContentPageGloss.SetBackgroundGradient( this, GradientBackground );
		Title = "My Content Page";
	}
}

This still compiles and runs without error but the navigation bar on iOS now remains the default white colour.

BarBackgroundColor

Hi,

Is there any way to use Gradient Background on BarBackgroundColor (NavigationPage)?

Tks

Having a Gradient on a Row of a Grid?

Similar to the request for the ability to have a Gradient over a whole grid...

We need to be able to have a Gradient over a part of the Page only - specifically we've got a header area of the page which needs a Gradient over it.

Is this possible? It seems not, as the Gradient is designed to work over the entire ContentPage or a Cell.

Does initialize XFGloss in Android project is needed?

Hi,

Adding the following code to my Android project:
// IMPORTANT: Initialize XFGloss AFTER calling LoadApplication on the Android platform XFGloss.Droid.Library.Init(this, savedInstanceState);
results with error "The name 'savedInstanceState' does not exist in the current context".
When deleting this above code XFGloss works on Android project so I wander why the above line of code needed for Android project?

Thanks,
AG

Low-level touch events label:enhancement

Xamarin has never had adequate touch support.
When we [MappingIndustries / LiveCaddie] switched from native (java) to Xamarin development, we developed our own common API and implemented it on iOS and Android.

Now switching from Xamarin.Android + Xamarin.iOS to Xamarin.Forms, I find that we are gradually adding classes like "TouchButton", which is Button + native renderer that maps (on Android) OnTouchEvent(Android.Views.MotionEvent e) and OnInterceptTouchEvent to methods in code behind.

Attached properties look like a great way to do this, and support a broader range of controls without the repetition that I am doing right now.

I posted some preliminary cross-platform code in a Xamarin forum a couple of years ago. Eventually would like to contribute a better solution, and this seems like a good project + technique to add to.

Realistically, I won't be able to collaborate in the next few months, but if I had experience implementing attached properties I might start to migrate the code we have into that format.

Mentioning this in case other people have interest in this topic, and to see whether you think this is a good fit with xfgloss.

Edit I just saw https://michaelridland.com/xamarin/xaml-attached-properties-tricks-in-xamarin-forms/ which shows how easy it is to attach a gesture via attached property, so that might get me started on attaching a cross-platform representation of Android OnTouchEvent.

EDIT 2 For my company, most of our advanced touch needs seem to be met by making a "TouchAwareContentView" which implements our ITouch interface [via platform Renderers], having as its child the custom control that needed advanced touch, and passing it in to custom child constructor as an ITouch. For example, to add touch to an OpenGL view. Or a Pan Gesture Behavior that knows where the original Down location was. A bit of code behind where we need it, but will get us through the next six months. So will revisit "doing it right" sometime in 2019.

-- ToolmakerSteve

UWP support

it would be great if there iss any UWP support

Support portable-net45

The latest version removed support for portable-net45 (.NETPortable,Version=v4.5,Profile=Profile111).
I know you want to move to .netstandard, but we are currently stuck on .NET 4.5 in our portable project.

Is there any reason to not support this anymore?

Could not install package 'Ansuria.XFGloss 1.1.2.89'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile111', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Make BackgroundColor and BackgroundGradient props aware of cell selection state

Currently, the selection state of cells isn't taken into account when the color/gradient specified in the BackgroundColor and BackgroundGradient properties are applied. This needs to be fixed.

Fixing this may also mean new SelectedColor and SelectedGradient properties would be useful. Investigate the viability of those while fixing this issue.

How to define as global style in App.xaml

I want to each ContentPage has following element
xfg:ContentPageGloss.BackgroundGradient
<xfg:Gradient Rotation="170">
<xfg:GradientStep StepColor="#9DCC5F" StepPercentage="0" />
<xfg:GradientStep StepColor="#00B0CD" StepPercentage="1" />
</xfg:Gradient>
</xfg:ContentPageGloss.BackgroundGradient>
How can I do in App.xaml?

Change to avoid specific XF versions

Thanks for this project, I just started looking into it!

Is it feasible to change the Nuget package to require a minimum version of XF? I know some packages are forced to require a specific version for compatibility reasons, and others can do simple minimums.

XFGloss incompatible with default Xamarin.Forms setup in Visual Studio 2017

  1. Create a new Xamarin.Forms UWP/mobile app with all the defaults selected.
  2. Install XFGloss

XFGloss appears to install but fails to ever load, indicated by an insidious warning icon on the Nuget Package:
https://imgur.com/a/m8WSSx3

A separate bug, in Visual Studio, prevents getting any more info about what went wrong - but the discussion in this StackOverflow post about the bug implies it's something wrong with how the Nuget Package sets its paths:
https://stackoverflow.com/questions/37208853/net-2015-references-with-yellow-triangle-for-nuget-packages-on-portable-librari

Attempting to use XFGloss in this scenario results in no typeahead on its namespace and build errors if you try to invoke it manually in codebehind or xaml forms.

Object reference error on iPad Only

I'm getting this error on iOS just when I try to deploy to a real device.

For some reason on XFGlossContentPageRenderer.ViewDidLayoutSubviews the NativeView property is null.

Is anyone having this error?

Object reference not set to an instance of an object (System.NullReferenceException)
  at XFGloss.iOS.Views.XFGlossGradientLayer.GetGradientLayer (UIKit.UIView view) [0x00000] in <b880fe36f9644f1bba52b7a93270c77f>:0 
  at XFGloss.iOS.Renderers.XFGlossContentPageRenderer.ViewDidLayoutSubviews () [0x00006] in <b880fe36f9644f1bba52b7a93270c77f>:0 
  at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSend_CGRect (intptr,intptr,CoreGraphics.CGRect)
  at UIKit.UIView.set_Frame (CoreGraphics.CGRect value) [0x00010] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/build/ios/native/UIKit/UIView.g.cs:3137 
  at Xamarin.Forms.Platform.iOS.ChildViewController.ViewDidLayoutSubviews () [0x0000e] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\TabletMasterDetailRenderer.cs:17 
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
 
 at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/UIKit/UIApplication.cs:79 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/UIKit/UIApplication.cs:63 
  at Useall.Useall.UseApp.iOS.Application.Main (System.String[] args) [0x00001] in C:\Desenvolvimento\Useall.Useall\Useall.Useall.UseApp\Useall.Useall.UseApp\Useall.Useall.UseApp.iOS\Main.cs:12 

ChildStep is set more than once error?

Hello, I have installed XFGloss and when I try to add a gradient step within my xaml file, i get a XAML error telling me that: "The property 'ChildStep' is set more than once."

must likely I forgot a step or two, any help would be great.
note: It does work in the code behind.

Visual studio 2017
Xamarin Forms 3.5.0.129452

here is my XAML code:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:xfg="clr-namespace:XFGloss;assembly=XFGloss"
             NavigationPage.HasNavigationBar="false"
            x:Class="amici.Logon">
    
    <xfg:ContentPageGloss.BackgroundGradient>
        <xfg:Gradient Rotation="150">
            <xfg:GradientStep StepColor="White" StepPercentage="0" />
            <xfg:GradientStep StepColor="White" StepPercentage=".5" />
            <xfg:GradientStep StepColor="#ccd9ff" StepPercentage="1" />
        </xfg:Gradient>
    </xfg:ContentPageGloss.BackgroundGradient>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.