Hi all!
Can you please help me to find a solution of a problem that I faced.
So, the problem: I have a ContentPage (called LoginPage) and a Shell (ShellPage) with many pages; the app need to have such structure - in FlyoutHeader there is a button which directs you to the LoginPage (there you as a user do a log in), after that you push a submit button (on the LoginPage), which has to direct you to the HomePage (it's inside the Shell) and bring some parametrs to it. The question is - how can I navigate from a contentPage (LoginPage) to the HomePage?
Navigation on ShellPage
Identifying culprit of TMS-90809 / UIWebView
We have a new app we are trying to submit to the app store (using TestFlight for pre-release beta testing) but are getting an Invalid binary message due to the reference of UIWebView:
TMS-90809: Deprecated API Usage - New apps that use UIWebView are no longer accepted. Instead, use WKWebView for improved security and reliability.
We've followed the guide provide by Xamarin here: https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview?tabs=macos#uiwebview-deprecation-and-app-store-rejection-itms-90809
We have:
- Upgraded Xamarin Forms to 4.6 or higher - 4.6.0.706
- Ensured Xamarin.iOS 13.10.0.17 or higher - 13.16.0.13
- Remove references to UIWebView (none in the first place)
- Ensured IOS build is set to "Link Framework SDKs Only" (already was)
- Added the required mtouch argument: "--optimize=experimental-xforms-product-type"
- Updated all build configs (release/iphone, release/simulator, debug/iphone, debug/simulator)
I've also deleted my packages, bin, and object folders to ensure I get a full build, yet continue to get this response when uploading.
I'm at a loss as to what else we can change / check to get this app through Apple's automated scanner and would appreciate any help.
I can declare an object as a UIWebView, which I think still exists as it's part of the UIKit, but I have no references to it and it's not in my code anywhere.
Azure App Service AD Authentication
I have a Xamarin Forms App that authenticates users against Azure AD using MSAL.NET and it works. This application also needs to access a .NET Core Web API running in Azure App Service and uses Azure AD for authentication. I was able to create a service principal for this app service, my mobile app and provide API access. Also, I set the API scope in code and I was able to get a token. But my requests to the App Service using this token fail with 401. Anyone has any thoughts?
Need to refresh calling ContentPage when called ContentPage is finished
OK, so this is an MVVM project.
I have a ContentPage (StudentListPage with StudentListViewModel) that presents a list of passing students. When a student is tapped (his name is Charlie) we go to another ContentPage, called StudentDetailPage with StudentDetailViewModel. We change the Charlie's status from passing to failing, save the record, then hit the android back button.
How does the StudentListViewModel get informed that StudentDetailViewModel updated Charlie's status, and that we should now refresh the list?
I could probably do this with some sort of kludgey code-behind madness, but I want to avoid gyrations. I'm looking for something quick, clean, correct and understandable. The best thing I've come up with so far, is to have the Detail VM send to a MessageCenter, and have the List VM subscribe to it and refresh when it detects an "i-just-saved" message from the Detail VM.
Color of the selected Shell Flyout item in Dark Mode
Hello there,
Going one step further for https://forums.xamarin.com/discussion/169547/shell-flyout-in-dark-mode-ios-13, my logical next question is how to change the selected item background color. It is currently light grey and it should ideally be possible to style it using XAML resources.
Maybe @DavidOrtinau will be able to help?
Xamarin.Forms adding custom fonts using ASSEMBLY
Hi,
I am facing a problem when adding the custom font using assembly, the custom font appear well in android but in UWP, the normal font appears. Why is that?
The custom font is EmpeddedResource
`[assembly: ExportFont("alfarooq2.ttf", Alias = "abc" )]
<Label Text="Welcom to Xamarin" HorizontalOptions="Center" TextColor="Black" VerticalOptions="Center" FontSize="40" /> </StackLayout>
`
Shell navigation not retaining hamburger menu
Well, as the title suggest when I navigate from the main pages established in my flyout menu I lose my hamburger menu, it is simply replaced by a back button. Is it possible to maintain the menu button for easy navigation back to core pages of my app?
RSACryptoServiceProvider SignData very slow on some android devices
I have xamarin forms android application. I am expiriencing slow signing, but only on some devices... out of 4 devices I tested, 2 work slow, other 2 take less than a second.
See the code below, last line is very slow... why?
var data = Encoding.ASCII.GetBytes(zoiTemp); var rsaCSP = (RSACryptoServiceProvider)certificate.PrivateKey; var cspParameters = new CspParameters(); cspParameters.KeyContainerName = rsaCSP.CspKeyContainerInfo.KeyContainerName; cspParameters.KeyNumber = rsaCSP.CspKeyContainerInfo.KeyNumber == KeyNumber.Exchange ? 1 : 2; var rsaAesCSP = new RSACryptoServiceProvider(cspParameters); var signature = rsaAesCSP.SignData(data, CryptoConfig.MapNameToOID("SHA256")); -- this line of code is taking about 10 seconds!!
How to close the Flyout menu of a Shell in Xamarin Forms programmatically?
I have created a shell with menu items. However, I want to navigate to a page outside of the shell from a button click on that page. When I'm on the button to navigate to the other page, the flyout menu does not close automatically? How do I close the flyout menu programmicatically when I click on the button?
How to close the Flyout menu of a Shell in Xamarin Forms programmatically?
I have created a shell with menu items. However, I want to navigate to a page outside of the shell from a button click on that page. When I'm on the button to navigate to the other page, the flyout menu does not close automatically? How do I close the flyout menu programmicatically when I click on the button?
How can one set the Backgroud color of a disabled flyout menu item in a shell in Xamarin.Forms?
I have a Flyout menu Item list in a Shell. Some items are disabled based on certain conditions.
E.g
public AppShell()
{
this.Items[1].Enabled = false;
this.Items[2].Enabled = false;
//Background Color? How
}
I have tried the SetValue method to attempt to change the Background color properties of the flyout menu items but no luck.
List all .mp3 files from Music folder of my Android device
Hi,
I am developing a music player app in Xamarin.Forms that uses MediaManager plugin. How can I list all .mp3 files from Music folder in my Android device and play it respectively. Also, can I get metadatas of an .mp3 files name, title, album, artist etc?
Is it possible to keep RadioButton as Header of the expandable control Xamarin forms 4.6
Hi,
I'm trying to make a payment method page where if you click on the radio button, the expander body should show the text boxes to add the corresponding details. So I tried this code:
`<Expander> <Expander.Header> <StackLayout> <RadioButton GroupName="PaymentMethod" Text="Credit/Debit Card" IsChecked="False"/> </StackLayout> </Expander.Header> <Expander.Content> <Grid Padding="10"> <Grid.RowDefinitions> <RowDefinition Height="auto"/> <RowDefinition Height="auto"/> </Grid.RowDefinitions> <Grid Grid.Row="0"> <StackLayout Orientation="Horizontal"> <local:XEntry Style="{StaticResource entry}" Placeholder="Card Number" PlaceholderColor="LightGray" MaxLength="100"/> <!--Text="{Binding CardNumber}"--> <local:XEntry Style="{StaticResource entry}" Placeholder="MM" PlaceholderColor="LightGray" Text="{Binding Month}" MaxLength="2"/> <Label Text="/"/> <local:XEntry Style="{StaticResource entry}" Placeholder="YY" PlaceholderColor="LightGray" MaxLength="2"/> <!--Text="{Binding Year}"--> <local:XEntry Style="{StaticResource entry}" Placeholder="CVV" PlaceholderColor="LightGray" MaxLength="3"/> <!--Text="{Binding CVV}"--> </StackLayout> </Grid> <Grid Grid.Row="1"> <StackLayout> <local:XEntry Style="{StaticResource entry}" Placeholder="Card Holder Name" PlaceholderColor="LightGray" MaxLength="100"/> <!--Text="{Binding CardHolderName}"--> </StackLayout> </Grid> </Grid> </Expander.Content> </Expander>`
But the expander was not working.. but when i added a lable in the header
`<Expander.Header> <StackLayout> <Label Text="Card Payment"/> <RadioButton GroupName="PaymentMethod" Text="{lang:Translate Card}" IsChecked="False"/> </StackLayout> </Expander.Header>`
It worked..I dont want the lable. Instead, I only need the radio button in the expandable header. Is it possible?
BindingSource of control changes when added into a view
I am trying to set a binding in C#. It's initialised once properly and then I get a warning that the control is looking into a different ViewModel for the property and does not update.
Is my view somehow overwriting the binding context of the control that I set in C#, if so how can I tell it to keep i'ts binding?
It does not seem to happen for controls that are binded in xaml
WebView difficulties
I am new to Xamarin and am trying to port an application that I once wrote for Windows Phone to Android, iOS and eventually Duo.
I have an html page that i need to display. There is embedded JavaScript in the html. In Windows Phone, once the page was loaded, I was able to execute the code with the following:
webBrowser.IsScriptEnabled = true;
webBrowser.InvokeScript("InitPage", dayOfWeek.ToString()....)
where "InitPage" is a function inside the html document.
(I am using the same html file for this app - I would would rather not change it if not necessary)
I have decided to use WebView to display the html.
I have added a callback: webView.Navigated += WebView_Navigated;
and in the callback, I think i need to call EvaluateJavaScriptAsync
I cannot figure out how to call the InitPage method and pass the required params with it.
ALSO, I can't seem to get the view to scroll.
Am I using the wrong control? I would appreciate any help in getting me past this roadblock
thanks
How can I save a video from an url, to internal storage?
I've tried this code, but I can't play the video
string pathToNewFolder = System.IO.Path.Combine(Android.OS.Environment.ExternalStorageDirectory.AbsolutePath, folder); Directory.CreateDirectory(pathToNewFolder); try { WebClient webClient = new WebClient(); webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed); string pathToNewFile = System.IO.Path.Combine(pathToNewFolder, System.IO.Path.GetFileName(url) + ".mp4"); webClient.DownloadFileAsync(new System.Uri(url), pathToNewFile); } catch (Exception ex) { if (OnFileDownloaded != null) OnFileDownloaded.Invoke(this, new DownloadEventArgs(null,null,null,null,0)); } return pathToNewFolder;
How to perform drag and drop in xamarin forms ?
I have multiple list of Images. now i want to drag an image from one list and drop it to other list. and remove that image from previous list and add it to new list.how i can achieve this ?I'm using collection view.Is there Nuget package ?
Binding not working
Hi, I have been trying to get a binding to work so that the back button is disabled once it has been clicked on. This is all done in MyContentPage which is inherited by all the pages within the App. There is not command on the button so that shouldn't be interfering with my binding.
Button to be enabled/unenabled:
Button testButton = new Button() { Text = "Test" }; testButton.Clicked += TestButton_Clicked; testButton.BindingContext = this; testButton.SetBinding(Button.IsEnabledProperty, nameof(BackButtonEnabled));
private void TestButton_Clicked(object sender, EventArgs e) { this.BackButtonEnabled = false; }
Property and property changed code:
private bool _backButtonEnabled = true; /// <summary> /// Allows us to disable the back button when it is clicked so that we don't click on it multiple times. /// </summary> public bool BackButtonEnabled { get { return _backButtonEnabled; } set { if (value != _backButtonEnabled) { _backButtonEnabled = value; OnPropertyChanged(nameof(BackButtonEnabled)); } } } protected override void OnPropertyChanged(string propertyName) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); }
I have also done the SetBinding() with a converter. The converter triggers when the bind is set but not when the Property Changed event has been triggered. All the this
keywords appear to be picking up the Settings page (that inherits this class). It is pretty much exactly like another binding I have elsewhere in the App so I don't understand what I am doing wrong - can anybody else spot anything?
Thanks
Is there a way of getting all the used NuGet packages in a Xamarin.Forms project from the code?
Title...
I need to show all of the NuGet packages used in my app in the legal info. Is there a way of doing it programmatically so that I don't have to come back each time we use a new NuGet package?
Localization stopped working for Android
I'm trying to support two languages for my app, English and Japanese. This was working, and is still working for iOS, but stopped working for Android. It's been a few weeks since I added localization and last tested this. In the meantime I've been working on other functionality. I don't believe I changed anything that should have broken this, but nonetheless it stopped working. Does anyone have any suggestions on how to diagnose the problem?
I've confirmed that when I change the system's language that CultureInfo.CurrentUICulture
is properly changing to Japanese, but none of my strings are switching to Japanese.
I'm not see any errors or exceptions, and I've scanned through logs, but I don't see anything related. Again, this is working fine on iOS, just not Android.