Xamarin iOS keyboard Covers Entry - c#

My issue with the keyboard covering my Entry is very specific. I have found two fixes to this issue.
Wrap the whole page in a scrollview, iOS by default will resize when the page is a scrollview.
This would work but the page is made for messaging and has a StackLayout with two children, a scrollview with all of the previous messages being displayed, and a Stacklayout with an entry field and an Image of an arrow. When the StackLayout put into a scrollview the entry field stays at the bottom of the page which is not ideal.
Here is an example of the first fix:
https://www.screencast.com/t/mEf0VikS
I also found a render:
https://github.com/adamped/SoftInput/blob/master/SoftInput/SoftInput.iOS/Render/KeyboardRender.cs this render would work but for reasons I do not know it would resize the page correctly, but will always send the user to the top of the page. Here is an example of the second fix:
https://www.screencast.com/t/KzrZw92B20X
I would like to avoid using Nuget packages but if that is the only other way to fix this issue I would be ok with it.

In my case, I'm using grid and stacks, wrap my root layout in a ScrollView and set the orientation to neither. And it works without any Nuget and code-behind.

Related

How to make axis/index visible always even if scrolled the page far right or far below in Xamarin Forms?

I'm trying to make Xamarin forms application, in which the data should look like this.
However, it can be seen that the height and width of the view are large and I need to scroll the page both horizontally and vertically. So, when I scroll only the data portion should move while the A and B axes stay constant. If I move to column B6 then the view should be as shown below
and from this point if I move row A5 the view should be as shown below.
I'm quite new to xamarin forms or any other android development programming. At this point, I'm just trying to know what kind of search terms that I should use where I can find some documentation related to make such kind of view in my application. I guess a simple idea can be just using a scrollbar but I need my axes points visible all the time even if I scroll far right or far below.
Any suggestions?
Thank you!
To your question, you can search with scrollview, it is a layout that's capable of scrolling its content. You can set the orientation of your scrollview as "both" so it can scroll both horizontally and vertically.
But it can only have one content to scroll. It means scrollView objects should not be nested with other controls that provide scrolling, such as CollectionView, ListView, and WebView. For more information, you can refer to https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/scrollview

ContentControl WPF does not display Content

I've convertet the Project from https://silverlightcontrib.codeplex.com/ to WPF (github https://github.com/jogibear9988/silverlightcontrib) to get EMF/WMF metafile support in WPF.
Now my Probjem is, the EMF Class uses a ContentControl for displaying it's Content. The Content is also set, but nothing is displayed. If I check it in WPF-Inspector, I see that the EMF Control has it's Content listed in the "Logical-Tree" but not in the Visual! Can anyone help me out with this?
The current state of the Fork is Online (if anyone will look at the Code!)
If I look in snoop everything seems alright:
You see, the Content Presenter has a Content set and Filled, but it does not get into the Visual Tree...
Here is the Logical Tree from WPF Inspector:
And here the Visual:
I am not very familiar with Silverlight, but in WPF when you override MeasureOverride(...) and ArrangeOverride(...) you have to measure and arrange the contol's children so they can measure and arrange their children and so on.
In your case, you have to include calls to base.MeasureOverride(...) and base.ArrangeOverride(...) in the Emf class that inherits from ContentControl.
The two most likely issues are that your ContentControl is using a ControlTemplate that has no ContentPresenter (on one that is specifically using something other than the default Content property) or that it is using an empty DataTemplate as its ContentTemplate. You should be able to check either of these by inspecting at runtime.
I haven't quite figured this out, but it's something to do with the sizing. In Snoop it is showing a RenderSize of 0,0 and in inspector the actual height/width is also showing as 0 - you can see the red highlight inspector draws around the element is a small dot rather than a rectangle. I am guessing there's some Silverlight specific behaviour in the EMF control that doesn't port directly to WPF.

windows store app page blank when navigating to it

I have 3 pages in my application.
First page: 5 Buttons, each navigates to different page (currently, only the first button works).
Second page: Back Button and ListView, the ListViewItems are UserControlItems with Button, Image and TextBlock. When you click on the Button (of the UserControlItem) it Navigates to the third page, which is Media Player Page with alot of controls.
Third page: Media Player page with alot of controls such as MediaElement, Slider, Buttons and more
When I navigate from Third Page to Second Page using the Back Button, sometimes the screen stays black (the color of the theme) and sometimes it loads too much time. In addition, the ListView has visible vertical scrollbar (always) which is not shown unless you move your mouse on the ListView.
How to fix these problems?
EDIT 1:
link to my project - put some .wmv/.mp3/.mp4 files in the Videos Library folder.
EDIT 2:
I investigated the black page issue abit more and I found that the MediaElement is the cause.
The MediaElement stores the stream and it slows the computer.
In order to resolve to problem, when you click on the GoBack Button, it first set the source of the MediaElement to null, and only when the MediaElementState == Closed, I go back - seems to solve my problem (since I applied the solution I didnt experience more black screens).
About the scrollbar - I think I'll be able to solve it if I simulate MouseOver over the ListView - no idea how to do it
Ok Ill List out the issue one by one.
List View Scroll Bar : Since we are developing for a potential touch surface so scrollbars are not meant to be visible every time.
Blank Page : When you press the back button then Big page Ie third page gets stored in the forward navigation property of the history element. Additionally all the resources that were being used in the third page is disposed. So the time taken to go to second page becomes huge.
Please try havig a fourth page which will have less controls. And see if any Black background issue is occuring or not. It will give a better and clear picture.
--- Update Code for permanent visibility of scroll bar---
Please download the code for listview styling from
Listview styles
add your code to the project
and replace all FadeOutAnimation By FadeInAnimation.
This was the quickest I could do for a solution. For a Better one you can always play with the styles.
Ohh one more thing please add
Style="{StaticResource ListViewStyle1}"
To your list view. please try and let me know.

What is the purpose of Popup in XAML Metro apps?

I needed a modal dialog for my app but it appeared there is nothing like that in XAML Metro app. Someone suggested a popup.
I tried and it appeared that underlying UI still responsive.. so a Popup is not modal.
I thought OK may be its purpose is to be a popup in the center of the screen regardless the other layout and it appeared - not. Popup is bound to a layout as everything else. if it is in a grid it will be placed in row 0 and column 0 not in the center..
So may be I missing something. please help to understand. I cant find any use for it different from what can be achieved by using Grid.
what is the purpose of Popup? how it different from any other content controls?
Differences:
You don't have to put it as a child of another control. Though in such scenarios you might get problems traversing the visual tree and focusing on a TextBox won't shift its contents so the virtual keyboard might cover its contents or its adorner contents might lose alignment to adorned controls not on the Popup.
Its content tree is rendered on top of any other content and (I believe) doesn't get clipped by parent control's Clip regions.
You usually need to set its Width and Height manually when first showing or when parent layout (or size) changes, especially in one of the most common scenarios when you set its Width and Height to the Width and Height of the parent (or the window).
That said - modal dialogs are bad UI and should be avoided. You can simply navigate to another page if you would otherwise want to display a dialog or use other approaches. There's (almost) nothing more annoying than displaying a modal dialog over UI that looks otherwise enabled but doesn't respond to input.
I needed a modal dialog for my app but it appeared there is nothing like that in XAML Metro app. Someone suggested a popup.
Since Windows 8.1, there is actually something similar to a modal dialog that you may want to look into:
It's called Flyouts.
Apparently a modal popup with custom content is missing in Windows 8.1. One possible workaround:
use a Popup control (per se not modal)
make the background semi-transparent
stretch it across the entire screen
place the actual popup content inside that container and leave some space around it
Now, the parent page is visible but dimmed, and it cannot be accessed as the Popup is covering it.

WPF Control Questions

I just switched over to WPF from just regular C# .NET for the more advanced UI design controls. I have managed to become extremely confused over what should be extremely simple, and I hope someone can help.
Basically I want to have sections on either side (for the most part these will be list-boxes inside of expanders), one list-box in the bottom-middle, and then a large rich text box taking up the middle.
My understanding was that I could just take a DockPanel, set the ChildFill to true, dock each one where it should go, and leave the last one to fill the space. The list boxes alone don't seem to work at with the DockPanel, and the DockPanel does not seem to expand when I change the size of the window.
So basically my questions are...
1) Why does the DockPanel not expand/shrink when I change the size of the window?
2) Buttons seem to work fine in the Dock Panel (like all of the examples I found) but using List Boxes instead does not seem to work properly. Why is this?
3) If I put the list boxes inside of Expanders instead, if I have say two of these on the left side, and I shrink the top expander, will the bottom expander grow upwards to fill the gap?
I can't really afford anything like ActiPro, and I was not able to get the AvalonDock controls to show up on the MSVC 2010 toolbar, so I am pretty much stuck using the default controls.
1). I have just tested the DockPanel and it does expand / shrink when the Window is resized - Have you removed the Grid that is placed in the Window by default in Visual Studio? If you mean it doesn't resize proportionally to the Windows size then i think you will need to use a Grid.
2). Again, list boxes work fine for me - Can you provide some more detail explaining why they don't work properly?
3). It depends on what you mean by "Grow upwards". If the top expander is closed, only the header will be displayed and the bottom expander will move up to take the space taken by the first expanders content (this is the default behaviour).
Do you have some XAML you can post as this will help identify your problems.

Categories

Resources