Hiii community..
I have a small issue i.e I need to lock device orientation to landscape
i have tried info.plist but its not working
is there any solution to lock orientation in Code
Thanks
Hiii community..
I have a small issue i.e I need to lock device orientation to landscape
i have tried info.plist but its not working
is there any solution to lock orientation in Code
Thanks
I am trying to create a List with items structured as in the picture. I cant figure out how I should combine that kind of ListItem that can be expanded (see arrow) plus having the text fields like shown in the picture. On top of it I am trying to include so that each section of the list should have an header. Could somebody give me a hint of how to achieve the ListView as below:
This is my xaml page
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:prism="http://prismlibrary.com" xmlns:ff="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms" xmlns:ffTransformations="clr-namespace:FFImageLoading.Transformations;assembly=FFImageLoading.Transformations" xmlns:controls="clr-namespace:InstagroomEX.Controls" prism:ViewModelLocator.AutowireViewModel="True" x:Class="InstagroomEX.Views.HomePageView" Title="Home" BackgroundColor="ForestGreen" NavigationPage.HasNavigationBar="False" x:Name="root"> <StackLayout> <CollectionView ItemsSource="{Binding Images}"> <CollectionView.Header> <StackLayout Orientation="Vertical"> <CollectionView ItemsSource="{Binding Source={x:Reference root}, Path=BindingContext.ImagesPath}" HeightRequest="80" Margin="4,0,0,0"> <CollectionView.Header> <Grid HeightRequest="80" WidthRequest="80"> <controls:SquareImage Source="{Binding Source={x:Reference root}, Path=BindingContext.UserAvatarPath, Mode=OneWay}" Aspect="AspectFill" Margin="8,8,8, 8"> <controls:SquareImage.Transformations> <ffTransformations:CircleTransformation /> </controls:SquareImage.Transformations> </controls:SquareImage> <controls:SquareImage Source="AddPlus.jpg" HorizontalOptions="End" VerticalOptions="End" HeightRequest="16" WidthRequest="16" Margin="0,0,8,8"> <ff:CachedImage.Transformations> <ffTransformations:RoundedTransformation Radius="1000"/> </ff:CachedImage.Transformations> </controls:SquareImage> </Grid> </CollectionView.Header> <CollectionView.ItemsLayout> <LinearItemsLayout Orientation="Horizontal" ItemSpacing="0" /> </CollectionView.ItemsLayout> <CollectionView.ItemTemplate> <DataTemplate> <Grid HeightRequest="80" WidthRequest="80"> <controls:SquareImage Source="{Binding .}" Aspect="AspectFill" Margin="8, 8"> <controls:SquareImage.Transformations> <ffTransformations:CircleTransformation BorderSize="16" BorderHexColor="#e300b9"/> </controls:SquareImage.Transformations> </controls:SquareImage> </Grid> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> <BoxView BackgroundColor="#524b50" HeightRequest="1"/> </StackLayout> </CollectionView.Header> <CollectionView.ItemsLayout> <LinearItemsLayout ItemSpacing="8" Orientation="Vertical"/> </CollectionView.ItemsLayout> <CollectionView.ItemTemplate> <DataTemplate> <StackLayout Orientation="Vertical"> <StackLayout Orientation="Horizontal"> <ff:CachedImage Aspect="AspectFill" Source="{Binding Source, Mode=OneWay}" HeightRequest="40" WidthRequest="40" Margin="12,0,0,0" MinimumHeightRequest="100"> <ff:CachedImage.Transformations> <ffTransformations:CircleTransformation/> </ff:CachedImage.Transformations> </ff:CachedImage> <Label Text="Username" FontSize="18" VerticalOptions="Center"/> </StackLayout> <ff:CachedImage Aspect="AspectFill" Source="{Binding Source, Mode=OneWay}"/> <StackLayout Orientation="Horizontal"> <ff:CachedImage Aspect="AspectFill" Source="Like.png" HeightRequest="36" WidthRequest="40" Margin="12,0,0,0" MinimumHeightRequest="100"> <ff:CachedImage.Transformations> <ffTransformations:CropTransformation/> </ff:CachedImage.Transformations> </ff:CachedImage> <ff:CachedImage Aspect="AspectFill" Source="comment.png" HeightRequest="40" WidthRequest="40" Margin="0,0,0,0" MinimumHeightRequest="100"> <ff:CachedImage.Transformations> <ffTransformations:CropTransformation/> </ff:CachedImage.Transformations> </ff:CachedImage> </StackLayout> <Label Text="Понравилось: M" FontSize="18" FontAttributes="Bold" Margin="12,0,0,0"/> <Label LineBreakMode="WordWrap" BackgroundColor="Aquamarine" HorizontalTextAlignment="Start" Margin="12,0,12,0"> <Label.FormattedText > <FormattedString> <Span Text="username: " FontSize="14" FontAttributes="Bold"> </Span> <Span Text="{Binding Source={x:Reference root}, Path=BindingContext.PostUserDescription, Mode=OneWay}"/> <Span Text="{Binding Source={x:Reference root}, Path=BindingContext.LoadMoreUserDescription, Mode=OneWay}" FontSize="14" TextColor="Red"> <Span.GestureRecognizers> <TapGestureRecognizer Command="{Binding Source={x:Reference root}, Mode=OneWay, Path=BindingContext.ExecuteLoadMoreUserDescriptionCommand}" /> </Span.GestureRecognizers> </Span> </FormattedString> </Label.FormattedText> </Label> <Label Text="More" FontSize="16" TextColor="Red" Margin="12,0,0,0" HorizontalOptions="Start" VerticalOptions="Center"/> <Label Text="show all () comments" HorizontalOptions="Center" VerticalOptions="Center" FontSize="12" TextColor="Red"/> </StackLayout> </DataTemplate> </CollectionView.ItemTemplate> </CollectionView> </StackLayout> </ContentPage>
And my ExecuteLoadMoreUserDescriptionCommand command doen't invoke from my ViewModel. other elements bind without problems. What is wrong with my binding?
For a registration page , on click of register it calls the rest API to register the user. But after clicking on register if i goes to background and comes to foreground it throws web exception that operation can not be completed and software caused connection abort. Any suggestions how to handle this scenario. It occurs only in iOS. Android works fine. I have enabled background modes also, and provided the interval also for background fetch but it stills throws error. TIA. @JamesMontemagno @JohnMiller @RHudson @jezh @JoeManke
Hello every one i just want to ask how can i make SkiaSharp path fill the page width no matter the size of the screen
this what i got when the app open in bigger screen
this my code
view :
<skisharp:SKCanvasView x:Name="canvsview" PaintSurface="canvsview_PaintSurface" HorizontalOptions="Fill" Margin="0,-15,0,10" WidthRequest="1050" HeightRequest="750" > </skisharp:SKCanvasView>
backend :
private void canvsview_PaintSurface(object sender, SkiaSharp.Views.Forms.SKPaintSurfaceEventArgs e) { SKImageInfo info = e.Info; SKSurface surface = e.Surface; SKCanvas canvas = surface.Canvas; // Create new Color var Color = new SKColor(93, 156, 255, 255); // The Gradient's Color List SKColor[] GradientColors = { new SKColor(255, 255, 255, 255), Color, Color }; // The Gradient's Weight List float[] GradientWeights = { 0f, 0.5292227f, 0.9662447f }; // Create new Gradient var Gradient = SKShader.CreateRadialGradient(new SKPoint(80.96484f, 103.4766f), 514.6058f, GradientColors, GradientWeights, SKShaderTileMode.Clamp); // Fill color for Bezier Style var BezierStyleFillColor = new SKColor(230, 230, 230, 255); // New Bezier Style fill paint var BezierStyleFillPaint = new SKPaint() { Style = SKPaintStyle.Fill, Color = BezierStyleFillColor, BlendMode = SKBlendMode.SrcOver, IsAntialias = true, Shader = Gradient }; // Frame color for Bezier Style var BezierStyleFrameColor = new SKColor(253, 253, 253, 255); // New Bezier Style frame paint var BezierStyleFramePaint = new SKPaint() { Style = SKPaintStyle.Stroke, Color = BezierStyleFrameColor, BlendMode = SKBlendMode.SrcOver, IsAntialias = true, StrokeWidth = 1f, StrokeMiter = 4.934776f, StrokeJoin = SKStrokeJoin.Miter, StrokeCap = SKStrokeCap.Butt }; // Define Bezier shape path var BezierPath = new SKPath(); BezierPath.MoveTo(new SKPoint(-91.88669f, 30.0715f)); BezierPath.QuadTo(new SKPoint(-91.60303f, 200.0677f), new SKPoint(-91.31882f, 370.0643f)); BezierPath.QuadTo(new SKPoint(89.03607f, 504.918f), new SKPoint(455.6078f, 373.5671f)); BezierPath.QuadTo(new SKPoint(581.9626f, 307.0941f), new SKPoint(908.1133f, 349.7952f)); BezierPath.QuadTo(new SKPoint(907.4724f, 189.5722f), new SKPoint(906.8309f, 29.34904f)); BezierPath.QuadTo(new SKPoint(485.4685f, 4.917984f), new SKPoint(60.62561f, 20.74986f)); BezierPath.QuadTo(new SKPoint(-91.88669f, 30.0715f), new SKPoint(-91.88669f, 30.0715f)); // Draw Bezier shape BezierStyleFillPaint.Shader = SKShader.CreateRadialGradient(new SKPoint(368.1408f, 298.8855f), 514.6058f, GradientColors, GradientWeights, SKShaderTileMode.Clamp); canvas.DrawPath(BezierPath, BezierStyleFillPaint); canvas.DrawPath(BezierPath, BezierStyleFramePaint); }
Hi all,
I have been working to develop my first Xamarim forms apps for 2 months straight now. So far I have been able to find answers by researching on this forum except for this one.
I used Microsoft.EntityFrameWorkCore.Sqlite to manage an internal database on the device. When I add entities (records) to an instance of my context, or when I call EnsureCreate, no problem if I am running without linking anything (i.e. linker set to none). However when I set linker to link SDK assemblies only, I cannot execute any action on the database be that adding an entity or even calling EnsureCreate. Error message System.ArgumentNullException: 'Value cannot be null.
Parameter name: key'
I really need to publish this app, so I submitted it without any linking. Google Playstore accepted it despite the larger size, but Apple app store rejected it saying that assembly is too large.
I hope someone can help me get back on track.
Hi there
Whats the easiest way to access the Google Cloud Speech API within Xamarin.Forms?
I tried the following code in my PCL-Project (debugging with an Android-Phone)
Assembly assembly = typeof(Program).GetTypeInfo().Assembly; Stream stream = assembly.GetManifestResourceStream("ConsoleApp1.speech_auth.json"); string resultString = null; using (StreamReader reader = new StreamReader(stream)) { resultString = reader.ReadToEnd(); } GoogleCredential credential = GoogleCredential.FromJson(resultString); if (credential.IsCreateScopedRequired) { credential = credential.CreateScoped(new[] { "https://www.googleapis.com/auth/cloud-platform" }); } var channel = new Grpc.Core.Channel(SpeechClient.DefaultEndpoint.Host, credential.ToChannelCredentials()); var speech = SpeechClient.Create(channel); var response = speech.Recognize(new RecognitionConfig() { Encoding = RecognitionConfig.Types.AudioEncoding.Flac, SampleRateHertz = 16000, LanguageCode = "de-CH", }, RecognitionAudio.FromFile("test.flac"));
However, I get an error message on the line:
var channel = new Grpc.Core.Channel(SpeechClient.DefaultEndpoint.Host, credential.ToChannelCredentials());
which says:
Unhandled Exception: System.NotImplementedException: The method or operation is not implemented
Whats the problem there? Is there any better solution?
On a blank .NET ConsoleApplication, this code is working without problem.
Hello friends, i have main and popup pages.
my architecture is MVVM and i want to call back a string from popup page.
i tried EventHandler . Normally it works but for MVVM i couldnt make it work.
Any ideas?
Thanks in Advance;
I am encountering an error when assigning a new page to a class parameter. It appears that it has not been initialized and is null. What is it and how is it initialized? The code is in the PCL and has no problems in either Android or UWP.
<p>Object reference not set to an instance of an object</p><p>Data ----------</p><p>System.Collections.ListDictionaryInternal</p><p>HResult ----------</p><p>-2147467261</p><p>Source ----------</p><p>Xamarin.Forms.Platform.iOS</p><p>StackTrace ----------</p><p>
at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.UpdateMainPage () [0x0000e] in d:\a\1\s\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:198 \n at Xamarin.Forms.Platform.iOS.FormsApplicationDelegate.ApplicationOnPropertyChanged (System.Object sender, System.ComponentModel.PropertyChangedEventArgs args) [0x00012] in d:\a\1\s\Xamarin.Forms.Platform.iOS\FormsApplicationDelegate.cs:152 \n at Xamarin.Forms.BindableObject.OnPropertyChanged (System.String propertyName) [0x00000] in d:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:229 \n at Xamarin.Forms.Element.OnPropertyChanged (System.String propertyName) [0x00000] in d:\a\1\s\Xamarin.Forms.Core\Element.cs:353 \n at Xamarin.Forms.Application.set_MainPage (Xamarin.Forms.Page value) [0x0008b] in d:\a\1\s\Xamarin.Forms.Core\Application.cs:91
I added the NotificationContentExtension for the IOS Project in xamarin forms.while building i am getting the below Error.
**Could not find any available provisioning profiles for iOS. NotificationContentExtension.
**
Do we create a new provision profile for this NotificationContentExtension ?
Please help us.
Thanks,
I am trying to remove the cell padding/borders in a Grid. I have read this thread: https://forums.xamarin.com/discussion/23295/can-the-padding-between-rows-in-a-grid-be-changed but none of the methods discussed there allow me to remove the spaces. How do I remove the invisible cell borders?
I've tried :
<Grid.RowDefinitions RowSpacing="0" <Grid.ColumnDefinitions ColumnSpacing="0"
And obviously I've tried Padding="0" in the <Grid
and <Grid.RowDefinitions
and <Grid.ColumnDefinitions
, but no luck.
To make a long story short, the following code crashes my app on startup with System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
It is just a normal property on an object contained in a Listview bound to an ObservableCollection.
private AnswerState _answerState; public new AnswerState AnswerState { get => _answerState; set { Device.BeginInvokeOnMainThread(() => { _answerState = value; OnPropertyChanged(nameof(AnswerStateText)); }); } }
If I remove Device.BeginInvokeOnMainThread() and put it further out, the app runs fine. The exception sure was misleading, and no stacktrace would guide me to find this. In fact, as it happens on startup, I am not even sure if the code in question is even being called before crashing.
I am implementing the theme switcher for iOS 13 from this guide:
https://devblogs.microsoft.com/xamarin/modernizing-ios-apps-dark-mode-xamarin/
I have it working for each time you open the app it will load the correct theme for the given setting, however if I have the app currently running and switch the them it wont hit my breakpoints in the renderer. Is there a way to change themes while app is running?
Thanks
Hi Xamarin Forum
does anyone already used FlowlistView to display images from recorded file path in database and display the image in a tile design just like instagram?
Hello!
Issue: I'm trying to share a folder of web assets to both iOS and Android projects without duplicating them, but I'm having a hard time understanding where they're copying to/where to point my WebView at.
My structure looks like:
MySharedProject
- Content
- data.json
- main.css
- index.html
[...]
MySharedProject.Android
- HybridWebViewRenderer.cs
[...]
MySharedProject.iOS
- HybridWebViewRender
[...]
Backstory: I had the assets in MySharedProject.Android -> Content -> Index.html , etc, then in my WebViewer, I had this code and everything worked.
Control.LoadUrl($"file:///android_asset/Content/{((HybridWebView)Element).Uri}");
I'm trying to take the raw assets out of iOS + Android so I don't have to keep duplicating my efforts when updating them.
1.) Is there a way to create a link/reference between the shared asset and platform assets?
2.) In Android, should I not be using "file:///android_asset/" to reach those assets?
3.) How do you reach copied shared assets from Android and from iOS?
Thanks!
Hi,
I've created a CarouselPage which contains 3 ContentPage. I want to achieve the next functionality:
To do this, I've done the next steps:
in App.xaml.cs:
public App() { InitializeComponent(); if (FirstTimeOpen()) { MainPage = new NavigationPage(new Page1()); } else { MainPage = new MainPage(); } } public bool FirstTimeOpen() { bool isFirstTime = false; var value = Preferences.Get("wasOpened",""); if (value.Equals("true")) { isFirstTime = false; } else { isFirstTime = true; } return isFirstTime; }
and in Page1.xaml.cs:
public Page1() { InitializeComponent(); } public void SetApplicationWasOpened() { Preferences.Set("wasOpened", "true"); } private void Button_Clicked(object sender, EventArgs e) { SetApplicationWasOpened(); Navigation.PushAsync(new MainPage()); }
This works fine but I'd like not to display the navigation bar when I swipe the carousel pages, or at least to color it white.
Thank you!
Using Xamarin.Forms v.4.4, Prism and Microsoft.AppCenter.Push
Sending Push notifications with AppCenter
The question is how to navigate to a specific page when a push notification is received?
Seems that this is one of the most common features, but I haven’t found a solid way to solve the problem.
There are 4 different scenarios and the important part is that none of them should interfere with the other.
One note that seems to be very important is that initial navigation in Xamarin.Forms (means when the app starts) needs to be in the constructor of the app in App.xaml.cs
(at least, this is what I read in Xamarin.Forms documentation.) Having Prism is a bit different and the initial navigation needs to be in OnInitialized()
In AppCenter.Push
there is the Push.PushNotificationReceived
where we can “attach” a code to run when a Push Notification is received but it doesn’t work in scenario 2. Also there is mix up with scenario 3 and 4. There is also a problem to identify whether is application is already running or resuming.
I tried the CrossGeeks/PushNotificationPlugin. There is an example that doesn’t do navigation. It goes to the MainPage and then changes a property. I wasn’t able to deal with scenario 2
I also tried CrossGeeks/FirebasePushNotificationPlugin. No luck…
I have created a Forms Shared Project solution and have multiple pages that go Page1 to Page2 to Page3 to Page4. From Page4 I want to pop out to Page1 or Page2 on the click of a button. But anything I have tried to PopAsync multiple times at once has failed (either an exception is thrown or it just doesn't pop more than one page).
My code in Page4 looks like this (Pages 1, 2, and 3 are on the page stack):
public class Page4 : ContentPage { public Page4 () { var button = new Button () { Text = "Pop Two Pages" }; button.Clicked += async delegate { await Navigation.PopAsync (); await Navigation.PopAsync (); }; Content = button; } }
The above code throws InvalidOperationException:
System.InvalidOperationException: Operation is not valid due to the current state of the object
at System.Collections.Generic.Stack`1[Xamarin.Forms.Page].Pop () [0x0000b] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Collections.Generic/Stack.cs:120
at Xamarin.Forms.NavigationProxy.OnPopAsync () [0x00000] in :0
at Xamarin.Forms.NavigationProxy.PopAsync () [0x00000] in :0
at NavigationTest.Page4+c__async0.MoveNext () [0x0007b] in /Users/devinrose/Dropbox/KetraProject/MobileExperiments/NavigationTest/NavigationTest/Page4.cs:15
My guess is that the second PopAsync is not valid because it has already popped this page off the stack. Using a single PopToRootAsync doesn't work due to a known Xamarin bug on iOS. Any ideas?
Hi I have a tabbed page and i'm trying to change the background colours from black to a different colour but it doesn't seem to be working.
I've got the following code- not sure what else to try..
namespace MyApp { public class HomePage : TabbedPage { public HomePage() { // Content = new Label { Text = "Hello ContentView" }; var searchPg = (new SearchPage() { Title = "Search", IconImageSource = "icons/search.png", }); ProfilePage profilePage = new ProfilePage(); var profilePg = new NavigationPage(_profilePage) { Title = "My Profile", IconImageSource = "icons/profile.png", }; Children.Add((profilePg)); Children.Add((searchPg)); this.BarBackgroundColor = Color.Red; } }
Hi,
I have defined the themes globally in App.Xaml and I have two navigation pages with Button control. When I explicitly defined Style to change a CornerRadius property (any property) for Button control with overriding themes(customized theme), the applied theme is not working.
Please find the prepared sample to replicate the issue.
Can anyone please look into and provide a possible solution?