Comments (12)
I've never contributed to a project before on github, and I'm not that good at XF to be able to build my own control but I have a control called NoHelperEntry (which I used online tutorials for). Its fairly straightforward but I wonder if instead of inheriting from Entry you inherit from NoHelperEntry instead?
so in the shared project:
namespace Controls { public class NoHelperEntry : Entry { } }
then in the iOS and Android projects you have these renders:
Android
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using Android.Text;
using Project.Controls;
using Project.Droid.Renderers;
using View = Android.Views.View;
[assembly: ExportRenderer(typeof(NoHelperEntry), typeof(NoHelperEntryRenderer))]
namespace Project.Droid.Renderers
{
public class NoHelperEntryRenderer : EntryRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
Control.ShowSoftInputOnFocus = false;
}
private void Control_FocusChange(object sender, FocusChangeEventArgs e)
{
if (e.HasFocus)
{
Control.ShowSoftInputOnFocus = false;
}
else
{
Control.ShowSoftInputOnFocus = false;
}
}
}
}
iOS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System;
using Xamarin.Forms.Platform.iOS;
using Xamarin.Forms;
using UIKit;
using CoreGraphics;
using Project.iOS;
using Project;
using Foundation;
using UIKit;
using Project.Controls;
[assembly: ExportRenderer(typeof(NoHelperEntry), typeof(NoHelperEntryRenderer))]
namespace Project.iOS
{
public class NoHelperEntryRenderer : EntryRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (Control != null)
{
Control.InputView = new UIView();
Control.SpellCheckingType = UITextSpellCheckingType.No; // No Spellchecking
Control.AutocorrectionType = UITextAutocorrectionType.No; // No Autocorrection
Control.AutocapitalizationType = UITextAutocapitalizationType.None; // No Autocapitalization
}
}
}
}
So with a big proviso that I may be doing it completely wrong, hopefully this helps!
from xfx.controls.
Try setting the Keyboard to 'Text'
from xfx.controls.
Already tried this but still autocorrection happens
from xfx.controls.
Does it happen if you use a regular Entry control?
from xfx.controls.
Yes. Same thing happens there also. Also i have writing a custom renderer on XfxEntry controls for ios and set the autocorrection to none but still the autocorrection happens.
from xfx.controls.
You didn't specify if you're on a device or simulator. Do you happen to have a custom keyboard by chance?
from xfx.controls.
Its having on both device and simulator. No i don't have custom keyboard. Attached is the snapshot for your reference.
As in the screenshot, i want to disable the suggestion coming just over the keyboard.
from xfx.controls.
Hello, I also reproduce this issue on both IPhoneSimulator and real IPhone. Can you fix this thing?
This issue is very important for login form.
I would do this in the simple entry (and it works):
<Entry Placeholder="test" Keyboard="Text"> <Entry.Keyboard> <Keyboard x:FactoryMethod="Create"> <x:Arguments> <KeyboardFlags>None</KeyboardFlags> </x:Arguments> </Keyboard> </Entry.Keyboard> </Entry>
from xfx.controls.
Same problem, any idea how fix this? @ChaseFlorell
from xfx.controls.
I can't change the Keyboard
for this custom entry control through XAML, code-behind or MVVM binding. From source code on the iOS Entry renderer, it looks like the Keyboard is being manually set to Native. It seems like this is the reason the Keyboard
property is never getting applied to the entry, it's being overwritten by SetKeyboard()
. I can do some experimenting with this when I get the time
from xfx.controls.
I can't change the
Keyboard
for this custom entry control through XAML, code-behind or MVVM binding. From source code on the iOS Entry renderer, it looks like the Keyboard is being manually set to Native. It seems like this is the reason theKeyboard
property is never getting applied to the entry, it's being overwritten bySetKeyboard()
. I can do some experimenting with this when I get the time
I'm having a similar issue when trying to set the Keyboard flag to CapitalizeCharacter (or any other value). I tried doing it in XAML and in .cs, It just gets ignored in iOS. In Android, it works as expected.
Did you (or anyone) find a workaround?
from xfx.controls.
Yes, it is indeed setting the KeyboardType using .ToNative() that is at the root of the issue. You can illustrate this by replacing the SetKeyboard() with the following, which no longer auto-capitalizes:
private void SetKeyboard()
{
Control.ApplyKeyboard(Keyboard.Create(KeyboardFlags.CapitalizeNone));
Control.ShouldReturn = InvokeCompleted;
}
Of course, this obviously doesn't solve the issue since it would then ignore your Keyboard property altogether :) The solution seems to be to update the SetKeyboard to use ApplyKeyboard() and only use ToNative() for the numberpad comparison:
private void SetKeyboard()
{
var kbd = Element.Keyboard;
Control.ApplyKeyboard(kbd);
Control.InputAccessoryView = kbd.ToNative() == UIKeyboardType.NumberPad ? NumberpadAccessoryView() : null;
Control.ShouldReturn = InvokeCompleted;
}
With this change I am then able to easily set the keyboard type and flags via XAML:
<xfx:XfxComboBox
Placeholder="Enter text"
SelectedItem="{Binding SelectedItem}"
ItemsSource="{Binding TextSuggestions}">
<xfx:XfxComboBox.Keyboard>
<Keyboard x:FactoryMethod="Create">
<x:Arguments>
<KeyboardFlags>CapitalizeNone</KeyboardFlags>
</x:Arguments>
</Keyboard>
</xfx:XfxComboBox.Keyboard>
</xfx:XfxComboBox>
While still maintaining the ability to specify a default keyboard type:
<xfx:XfxComboBox
Placeholder="Enter email"
SelectedItem="{Binding SelectedItem}"
Text="{Binding EmailAddress}"
ItemsSource="{Binding EmailSuggestions}"
Keyboard="Email" />
I'll try to put together a pull request (hoping that it'll get applied), but I thought I'd at least post this here for others since I had the same issue and there hasn't been any update.
from xfx.controls.
Related Issues (20)
- UWP Support HOT 1
- xfxEntry problem with Focus HOT 1
- Nuget update HOT 1
- Xfx Entry Readonly error
- Xfx ComboBox Gaps between list items
- Red Block appears behind CardView
- Completed event and ReturnCommand do not work
- How to make sorting algorithm async so it won't block the UI?
- Conflict with method PopToRoot of INavigation
- It doesn't seem the control works when in DataTemplate of repeating control. HOT 1
- xfx:entry ClearButtonVisibility
- problem with Combo : when typing digits HOT 2
- XfxCombobox =>suggestion not showing when user enter only single character HOT 3
- Show List When Xfx.Combobox clicked HOT 1
- XfxComboBox suggestion list not showing HOT 1
- xfxEntry problem with ReturnType HOT 27
- Build issue in Release mode (Linking SDK Assemblies) HOT 19
- XML documentation file missing from NuGet package
- On mainpage change I got error Object reference not set to an instance of an object HOT 11
- Maxlength is not working on XfxEntry HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xfx.controls.