Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 75885 articles
Browse latest View live

"IsPassword=True" Reverse the alignment of entry placeholder on some devices but others not


How do I hide the Tabs of TabbedPage when clicking a nested NavigationPage?

$
0
0

There is this great article on how to set up a TabbedPage:
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/tabbed-page

It shows how a page of a tab can be set up with a NavigationPage, which of course shows a Back button on any of it's children - So far so good. BUT, it's majorly flawed!

Once you click to open a child of NavigationPage (which renders Back button), the tabs need to disappear! They don't. How do we hide the tabs?

Referring to the screen cap gif below: Say I have a couple static pages in a tab, and also one tab is a Navigation Page. If I click to a tab ("Schedule"), then click a navigation (child) to get to the child page ("Upcoming appointments"), it renders a back button as expected. BUT... the tabs are still visible! Now if you click another tab (like "Today" or "Settings") WHILE the child of "Schedule" tab is open, you get into a bad state where the back button does NOTHING. You have to click on the originating parent tab ("Schedule") before you can click back and dismiss the navigation child page.

ugh.... really? And this is an official example posted in the docs and sample files? Sheesh.

How do we fix this? How do we hide the tabs when the child NavigationPage is loaded and back button rendered?

Real world example of what I want:
Open Facebook on your phone, see tabs while viewing your feed. Tap on the Alert tab (bell icon) and tap a post, and you see the tabs disappear, the child page you navigated to takes the FULL screen and and the back button appears.

Disposing of a ContentView that is included in a ContentPage

$
0
0

Hi

My app has several 'ContentPages' which incorporate several 'ContentViews'. I have included UI elements (such as a status bar) into a ContentView which I can then display from any ContentPage.

My ContentViews have their own ViewModels, and in the case of the status bar, it subscribes to ConnectionStateChanged and DatabaseChanged events from my back end code, and needs to neatly unsubscribe when the Page that incorporates the view disappears.

Is there a way to neatly dispose of the viewmodel associated with a ContentView - I note that View's dont implement dispose, and that, unlike a ContentPage, there is no OnDissapearing event that I can manually tie up.

At the moment, in the onDissappearing override for the ContentPage that calls up my ContentViews, I am calling each of the Dispose methods I have added to the codebehind for my contentViews using the x:Name="xyz" tag from the Xaml thus:

 protected override void OnDisappearing()
        {
            CompletedPatientEventsListCtrl.Dispose();
            BleNfcConnectionControl.Dispose();
            PatientEventsAwaitingCompletionCtrl.Dispose();
            ProteusConnectionStatusCtrl.Dispose();
            base.OnDisappearing();
        }

My question is - is there a better way?

Nigel

Creating a ViewRenderer (Custom view) programatically

$
0
0

I have a ViewRenderer implemented and I want to create from an (Android) platform an instance of this ViewRenderer (Let's call it HybridWebview) from code.

So far, all easy
hybridWebview = new ProjectPCL.HybridWebview ();

The object is created but the native "OnElementChangedOnElementChanged" is never fired, I guess because I do not add it to a form.

I can not add it to a form/activity because I do not have it, I want to create it in a service: It is a webview and I need to process Javascript.

This works without problems, I already have applications that do it, what I had never tried is that Webview was a ViewRenderer.

So the question is: How can I force that view to be created and therefore rendered without having a form?

Thank you.

How to change the listview scrollbar color in xamarin.forms using Custom Renderer?

$
0
0

I am able to change the color in Android. but in Ios i'm able to change only the black, white and default color using the UIScrollViewIndicatorStyle but unable to set custom Color, how to set custom color ?

Hardware Back Button

$
0
0

I've got an app which displays a login page modally when it detects that the user has not logged in. However, the user can still dismiss the login page using the hardware back button, thus returning to the app without valid credentials which shouldn't normally happen. It's not designed to have the user attempting to do things without permission so this behaviour can be confusing. Can I somehow disable the back button on the login page?

Unfocused of Entry Control not working properly on few Android devices

$
0
0

Hi,

I have two entry controls in my Xamarin forms. I have registered to Unfocused event of both entry control with respective target methods. The Xamarin forms version I am using is "3.6.0.344457". Here, when I Unfocus from first entry control and set focus of second entry control, the Unfocus event of both the entry controls i.e. first and second entry control get called.Whereas, it should only call UnFocus of first entry control. Also, when I erase whole content from second entry control using backspace key of softkeypad, UnFocus event of second entry control gets called. Whereas the Focus is still on "Second Entry Control". This happens only on certain Android phones like Huawei, Google Pixel with Android version 8.0.

It works perfectly fine on samsung S8 and S10 phones having Android version 9.0.0.

So, Can anyone guide me whether it is OS specific issue and why it is working fine with some devices.

Waiting for the answer.

Thanks in Advance,
Muffadal

How to resolve Could not load file or assembly 'Xamarin.Forms.Core, Version=2.0.0.0

$
0
0

Since updating my PCLs to use .Net Standard 2, my Android build is reporting the following. Can anybody suggest how to resolve this please? I am using VS 2017 Community v15.9.13 . My iOS and UWP builds work fine.

Using "RegisterAssembly" task from assembly "Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
Task "RegisterAssembly" (TaskId:631)
  Task Parameter:Assemblies=G:\tfs\myapp\myapp\AndroidForForms\AndroidForForms.Android\bin\Debug\AndroidForForms.Android.dll (TaskId:631)
  Task Parameter:TypeLibFiles=G:\tfs\myapp\myapp\AndroidForForms\AndroidForForms.Android\bin\Debug\AndroidForForms.Android.tlb (TaskId:631)
  Task Parameter:AssemblyListFile=obj\AndroidForForms.Android.csproj.UnmanagedRegistration.cache (TaskId:631)
  Task Parameter:CreateCodeBase=True (TaskId:631)
  Registering assembly "G:\tfs\myapp\myapp\AndroidForForms\AndroidForForms.Android\bin\Debug\AndroidForForms.Android.dll" for COM Interop. (TaskId:631)
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4786,5): error MSB3217: Cannot register assembly "G:\tfs\myapp\myapp\AndroidForForms\AndroidForForms.Android\bin\Debug\AndroidForForms.Android.dll". Could not load file or assembly 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
Done executing task "RegisterAssembly" -- FAILED. (TaskId:631)

Xamarin.Forms *needs* a hot reload system

$
0
0

Flutter is winning the hearts and minds of developers. I can see there is already jobs opening asking for flutter knowledge. Everywhere I read about flutter, people praise one functionality: "hot reload". I tested it and it is really nice. The thing is, flutter does not need it as much as XF. On flutter, things look the same on both devices so you do not spend so much time doing micro adjustments to the UI as on XF. The thing, I think, is that people learning need to see the changes they make to understand and learn. A person that does not know xaml will have a hard time even doing basic things look half decent. An experienced developer will have a hard time making things look exactly how he wants. It is possible but takes a lot of time.

I know about LiveXAML (http://www.livexaml.com/), I use it and it mostly works but it is not free. I know about XAMLator (https://github.com/ylatuya/XAMLator) and HotReload (https://github.com/AndreiMisiukevich/HotReload) but one only works on mac and the other I could not make work on android emulators. So, if this amazing developers are doing it, it is possible.

I think the most important thing for this feature is to be able to edit xaml on VS and see the change on emulators (android and iOS). It would be amazing if it could reload code changes too but only xaml will be a good start. It would be nice too if it could work without Visual Studio too, so I can edit .xaml files on VSCode and see the changes on my running app. This would make things so much better for experienced developers and for newcomers.

So my question is: when will Xamarin.Forms have an official hot reload system?

'C:\Program' is not recognized as an internal or external command, operable program or batch file. ?

$
0
0

Hi'
I'm new to xamarin forms. I'm getting this error " 'C:\Program' is not recognized as an internal or external command,
operable program or batch file." when I try to run the android emulater. Any ideas on how to solve this problem.

Where do I find my 'App Bundle' file for nUnit testing

$
0
0

Can't seem to find the file location designated for the App Bundle when configuring nUnit testing project in my xamarin forms app

        app = ConfigureApp
                        .iOS
                        .AppBundle("/????)
                        .StartApp();

How can I Intercept children added to layout?

$
0
0

I have tried to:

layout.PropertyChanging += Layout_PropertyChanging;
layout.PropertyChanged += Layout_PropertyChanged;

where layout is a StackLayout.
But the PropertyChangedEventArgs e parameter to the event handlers , e.PropertyName is never "Children":

private void Layout_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
   if(e.PropertyName == "Children")
   {
       Console.WriteLine("Children changed") // <-- never happens when adding children to layout
   }
}

I have also noted the ChildAdded event - which does fire when a child is added. But it is not exactly what I am looking for.

Is it deliberate that Children property does not fire a propertychanged/propertywillchange - hiding it. Offering us developers ChildAdded and ChildRemoved events instead?

HOW TO FETCH DATA FROM SQLITE CORRESPONDING TO AN ID

$
0
0

I have saved some information in sqllite and how can i fetch data from sqllite corresponding to an id.

Xamarin Forms DisplayAlert option text not displayed.

$
0
0

We are using Display Alter for confirmation prompt which is working fine with the messages display. But text for confirmation event like 'Yes' or 'No' is not displaying, but click event is happening by click the position of the options.

Screen shot for reference.

Example Code:

        var result = await DisplayAlert("Confirm", "Are you sure to update delivery date?", "OK", "Later");
        if (result)
        {
     }

Any help or suggestions would be thankful.!

Is there some variable or function from which I can read the most recent build timestamp?

$
0
0

This could be useful in an "About" page.


Is there a way to trigger Flyout in Shell by own button?

$
0
0

Can I do something like below:

var btn = new Button();
btn.Clicked += async delegate
{
ShowFlyout();
}

Thanks for any Suggestion

Is there a way to override a Back button press on Android?

$
0
0

I'm having issues with a ContentPage in my app. It consists of a WebView that fills the screen. There are links that users can click to be taken to different pages within the webview (these are all external URLs). But if you press the Back button on Android, the app navigates away from the web view page COMPLETELY, taking you back to the previous ContentPage (which unfortunately is almost always the login page, causing people to have to log back-in).

Is there a way to handle the Back button press and provide my own functionality? Ideally I'd like to first attempt to navigate back through the WebView's history (WebView has a GoBack() method), navigating to a different ContentPage ONLY if we're already at the beginning of the history.

This is possible with a "regular" Xamarin app (you can override an Activity's OnBackPressed() method), how can I handle it with Xamarin.Forms?

Center item in RelativeLayout

$
0
0

Hi guys,

I have faced with another issue ...
It is difficult to find how to center image or another item inside RelativeLayout ?!

I have found something like this solution:

<ffimageloadingsvg:SvgCachedImage
                    RelativeLayout.WidthConstraint="{ConstraintExpression 
                        Type=RelativeToParent,
                        Property=Width,
                        Factor=0.5,
                        Constant=0}"
                    RelativeLayout.HeightConstraint="{ConstraintExpression 
                        Type=RelativeToParent,
                        Property=Height,
                        Factor=0.5,
                        Constant=0}"
                    RelativeLayout.XConstraint="{ConstraintExpression 
                        Type=RelativeToParent,
                        Property=Width,
                        Factor=0.25,
                        Constant=0}"
                    RelativeLayout.YConstraint="{ConstraintExpression 
                        Type=RelativeToParent,
                        Property=Height,
                        Factor=0.25,
                        Constant=0}"
                    WidthRequest="50"
                    HeightRequest="50"
                    Source="resource://image.svg"/>

Is there better solution ?

How does one Programmatically determine the Screen Inch size of a device?

$
0
0

How does one Programmatically determine the Screen Inch size of a device i.e. 5", 5.7", etc.?

扣/薇1473277057 QUT认证毕业,证QUT毕业,证成 绩 单 QUT教育部学历认证† Queensland毕业,证成 绩 单 Queensland认证毕业,证† 昆士兰科技官网可查学历 昆士

$
0
0

扣/薇1473277057 QUT认证毕业,证QUT毕业,证成 绩 单 QUT教育部学历认证† Queensland毕业,证成 绩 单 Queensland认证毕业,证† 昆士兰科技官网可查学历 昆士兰科技大学毕业,证 QueenslandUniversityofTechnology 只办理毕业证可以找工作吗

Viewing all 75885 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>