Xamarin forms: Keyboard is not hiding when click background in xamarin forms IOS
In the normal case of xamarin forms ios app, the keyboard is hiding when taps on the background. Also, scrolling works perfectly when the keyboard is on.
But when the page contains listview, the keyboard is not closing when background tap and scrolling is not working in the same case.
How can I fix this issue? I need to close the keyboard when clicking the background and need scrolling feature. Error screenshot in android:
ios scroll xamarin.forms keyboard
add a comment |
In the normal case of xamarin forms ios app, the keyboard is hiding when taps on the background. Also, scrolling works perfectly when the keyboard is on.
But when the page contains listview, the keyboard is not closing when background tap and scrolling is not working in the same case.
How can I fix this issue? I need to close the keyboard when clicking the background and need scrolling feature. Error screenshot in android:
ios scroll xamarin.forms keyboard
add a comment |
In the normal case of xamarin forms ios app, the keyboard is hiding when taps on the background. Also, scrolling works perfectly when the keyboard is on.
But when the page contains listview, the keyboard is not closing when background tap and scrolling is not working in the same case.
How can I fix this issue? I need to close the keyboard when clicking the background and need scrolling feature. Error screenshot in android:
ios scroll xamarin.forms keyboard
In the normal case of xamarin forms ios app, the keyboard is hiding when taps on the background. Also, scrolling works perfectly when the keyboard is on.
But when the page contains listview, the keyboard is not closing when background tap and scrolling is not working in the same case.
How can I fix this issue? I need to close the keyboard when clicking the background and need scrolling feature. Error screenshot in android:
ios scroll xamarin.forms keyboard
ios scroll xamarin.forms keyboard
edited Nov 23 '18 at 8:20
Sreejith Sree
asked Nov 22 '18 at 9:07
Sreejith SreeSreejith Sree
396212
396212
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Cause:
When the listview is scrolling.The touch event will be blocked.
Solution:
You can set the keyboard dismiss when you start scroll the listView.You should implement it in CustomRenderer.Refer the following code.
in Forms
namespace xxx
{
public class MyListView:ListView
{
public MyListView()
{
}
}
}
in xxx.iOS
[assembly:ExportRenderer(typeof(MyListView),typeof(MyiOSListView))]
namespace xxx.iOS
{
public class MyiOSListView:ListViewRenderer
{
public MyiOSListView()
{
}
protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
{
base.OnElementChanged(e);
if(Control!=null)
{
Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
}
}
}
}
in xaml
<local:MyListView>
<local:MyListView.ItemsSource>
...
</local:MyListView.ItemsSource>>
</local:MyListView>
What change will come on the xaml part?
– Sreejith Sree
Nov 23 '18 at 8:02
Check my update answer.
– Lucas Zhang - MSFT
Nov 23 '18 at 8:08
I have android and UWP projects, getting error on android project
– Sreejith Sree
Nov 23 '18 at 8:20
I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?
– Sreejith Sree
Nov 23 '18 at 8:21
Hardware->keyboard->connect hardware keyboard
– Lucas Zhang - MSFT
Nov 23 '18 at 8:23
|
show 3 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427274%2fxamarin-forms-keyboard-is-not-hiding-when-click-background-in-xamarin-forms-ios%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Cause:
When the listview is scrolling.The touch event will be blocked.
Solution:
You can set the keyboard dismiss when you start scroll the listView.You should implement it in CustomRenderer.Refer the following code.
in Forms
namespace xxx
{
public class MyListView:ListView
{
public MyListView()
{
}
}
}
in xxx.iOS
[assembly:ExportRenderer(typeof(MyListView),typeof(MyiOSListView))]
namespace xxx.iOS
{
public class MyiOSListView:ListViewRenderer
{
public MyiOSListView()
{
}
protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
{
base.OnElementChanged(e);
if(Control!=null)
{
Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
}
}
}
}
in xaml
<local:MyListView>
<local:MyListView.ItemsSource>
...
</local:MyListView.ItemsSource>>
</local:MyListView>
What change will come on the xaml part?
– Sreejith Sree
Nov 23 '18 at 8:02
Check my update answer.
– Lucas Zhang - MSFT
Nov 23 '18 at 8:08
I have android and UWP projects, getting error on android project
– Sreejith Sree
Nov 23 '18 at 8:20
I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?
– Sreejith Sree
Nov 23 '18 at 8:21
Hardware->keyboard->connect hardware keyboard
– Lucas Zhang - MSFT
Nov 23 '18 at 8:23
|
show 3 more comments
Cause:
When the listview is scrolling.The touch event will be blocked.
Solution:
You can set the keyboard dismiss when you start scroll the listView.You should implement it in CustomRenderer.Refer the following code.
in Forms
namespace xxx
{
public class MyListView:ListView
{
public MyListView()
{
}
}
}
in xxx.iOS
[assembly:ExportRenderer(typeof(MyListView),typeof(MyiOSListView))]
namespace xxx.iOS
{
public class MyiOSListView:ListViewRenderer
{
public MyiOSListView()
{
}
protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
{
base.OnElementChanged(e);
if(Control!=null)
{
Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
}
}
}
}
in xaml
<local:MyListView>
<local:MyListView.ItemsSource>
...
</local:MyListView.ItemsSource>>
</local:MyListView>
What change will come on the xaml part?
– Sreejith Sree
Nov 23 '18 at 8:02
Check my update answer.
– Lucas Zhang - MSFT
Nov 23 '18 at 8:08
I have android and UWP projects, getting error on android project
– Sreejith Sree
Nov 23 '18 at 8:20
I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?
– Sreejith Sree
Nov 23 '18 at 8:21
Hardware->keyboard->connect hardware keyboard
– Lucas Zhang - MSFT
Nov 23 '18 at 8:23
|
show 3 more comments
Cause:
When the listview is scrolling.The touch event will be blocked.
Solution:
You can set the keyboard dismiss when you start scroll the listView.You should implement it in CustomRenderer.Refer the following code.
in Forms
namespace xxx
{
public class MyListView:ListView
{
public MyListView()
{
}
}
}
in xxx.iOS
[assembly:ExportRenderer(typeof(MyListView),typeof(MyiOSListView))]
namespace xxx.iOS
{
public class MyiOSListView:ListViewRenderer
{
public MyiOSListView()
{
}
protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
{
base.OnElementChanged(e);
if(Control!=null)
{
Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
}
}
}
}
in xaml
<local:MyListView>
<local:MyListView.ItemsSource>
...
</local:MyListView.ItemsSource>>
</local:MyListView>
Cause:
When the listview is scrolling.The touch event will be blocked.
Solution:
You can set the keyboard dismiss when you start scroll the listView.You should implement it in CustomRenderer.Refer the following code.
in Forms
namespace xxx
{
public class MyListView:ListView
{
public MyListView()
{
}
}
}
in xxx.iOS
[assembly:ExportRenderer(typeof(MyListView),typeof(MyiOSListView))]
namespace xxx.iOS
{
public class MyiOSListView:ListViewRenderer
{
public MyiOSListView()
{
}
protected override void OnElementChanged(ElementChangedEventArgs<ListView> e)
{
base.OnElementChanged(e);
if(Control!=null)
{
Control.KeyboardDismissMode = UIScrollViewKeyboardDismissMode.OnDrag;
}
}
}
}
in xaml
<local:MyListView>
<local:MyListView.ItemsSource>
...
</local:MyListView.ItemsSource>>
</local:MyListView>
edited Nov 23 '18 at 8:08
answered Nov 23 '18 at 6:28
Lucas Zhang - MSFTLucas Zhang - MSFT
1,975228
1,975228
What change will come on the xaml part?
– Sreejith Sree
Nov 23 '18 at 8:02
Check my update answer.
– Lucas Zhang - MSFT
Nov 23 '18 at 8:08
I have android and UWP projects, getting error on android project
– Sreejith Sree
Nov 23 '18 at 8:20
I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?
– Sreejith Sree
Nov 23 '18 at 8:21
Hardware->keyboard->connect hardware keyboard
– Lucas Zhang - MSFT
Nov 23 '18 at 8:23
|
show 3 more comments
What change will come on the xaml part?
– Sreejith Sree
Nov 23 '18 at 8:02
Check my update answer.
– Lucas Zhang - MSFT
Nov 23 '18 at 8:08
I have android and UWP projects, getting error on android project
– Sreejith Sree
Nov 23 '18 at 8:20
I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?
– Sreejith Sree
Nov 23 '18 at 8:21
Hardware->keyboard->connect hardware keyboard
– Lucas Zhang - MSFT
Nov 23 '18 at 8:23
What change will come on the xaml part?
– Sreejith Sree
Nov 23 '18 at 8:02
What change will come on the xaml part?
– Sreejith Sree
Nov 23 '18 at 8:02
Check my update answer.
– Lucas Zhang - MSFT
Nov 23 '18 at 8:08
Check my update answer.
– Lucas Zhang - MSFT
Nov 23 '18 at 8:08
I have android and UWP projects, getting error on android project
– Sreejith Sree
Nov 23 '18 at 8:20
I have android and UWP projects, getting error on android project
– Sreejith Sree
Nov 23 '18 at 8:20
I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?
– Sreejith Sree
Nov 23 '18 at 8:21
I am testing the ios app in simulator, keyboard is not showing on simulator, is there any way to check this feature with keyboard?
– Sreejith Sree
Nov 23 '18 at 8:21
Hardware->keyboard->connect hardware keyboard
– Lucas Zhang - MSFT
Nov 23 '18 at 8:23
Hardware->keyboard->connect hardware keyboard
– Lucas Zhang - MSFT
Nov 23 '18 at 8:23
|
show 3 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427274%2fxamarin-forms-keyboard-is-not-hiding-when-click-background-in-xamarin-forms-ios%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown