Hi,
I have a doubt regarding Google maps in xamarin forms. Does this library ( https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/3.2.1 ) support to add multiple sub layer into the base map?
Note : Need support for UWP and Android.
Thanks
Hi,
I have a doubt regarding Google maps in xamarin forms. Does this library ( https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/3.2.1 ) support to add multiple sub layer into the base map?
Note : Need support for UWP and Android.
Thanks
Hi,
I have migrated app from hockeyApp to Appcenter, Before I was using hockey app code in my Project to show update notification
MessagingCenter.Subscribe(this, "1", (sender) =>
{
HockeyApp.Android.Metrics.MetricsManager.Register(Application, AppId);
UpdateManager.Register(this, AppId);
});
But now I am using appctenter, so i dont understand how to write a code for update notiifcation
please help me with this
Thanks
Hello,
Reading the (old) article about Layout Compression (https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/layouts/layout-compression) says:
Since layout compression removes a layout from the visual tree, it's not suitable for layouts that have a visual appearance, or that obtain touch input. Therefore, layouts that set VisualElement properties (such as BackgroundColor, IsVisible, Rotation, Scale, TranslationX and TranslationY) or that accept gestures, are not candidates for layout compression.
OK, this sounds clear. When I go to https://docs.microsoft.com/en-gb/dotnet/api/xamarin.forms.visualelement?view=xamarin-forms to see which are all the VisualElement
properties, I see for instance in addition to the few examples:
Height
HeightRequest
MininumHeightRequest
Now, the official sample app for Layout Compression shows this (https://github.com/xamarin/xamarin-forms-samples/blob/master/UserInterface/LayoutCompression/LayoutCompression/Views/ConnectSocialButton.xaml):
<StackLayout CompressedLayout.IsHeadless="true" HeightRequest="32" Orientation="Horizontal">
where HeightRequest
is specified. Does it mean that the various Height*
and Width*
properties of VisualElement
are actually fine with Layout Compression?
Question 2: to be sure since I'd like to mass-add CompressedLayout.IsHeadless="true"
without having to think much about where it should not be used, how about Margin
or Padding
? It's not in the list of properties of VisualElement
but I'm a bit unsure because of this non-exhaustive list of properties touched which imply to NOT use Layout Compression.
Hello there!
I am looking the control like the iPhone Settings.
It is almost like a one column grid, but you can click on a row to drill down to that specific detail.
Fill in the detail and then go back.
I have the picture attached.
What is this control?
Hey.
My problem is that when I try to make a get request to any api it refuses to connect to it for some weird reason.
The code is pretty simple.
No error is catched.
private async void Button_Clicked(object sender, EventArgs e)
{
using(var client = new HttpClient())
{
try
{
client.BaseAddress = new Uri("https://source.unsplash.com/random"); // Debugger continues here
var response = await client.GetStringAsync(client.BaseAddress); // Debbugger stops here
var content = response; // Debugger skips this
//List<Samtykke> samtykker = JsonConvert.DeserializeObject<List<Samtykke>>(content);
NavigationPage navigationPage = new NavigationPage(new SigningPage()); // Debugger continues here
await Navigation.PushAsync(navigationPage);
}
catch (Exception es)
{
Console.WriteLine(es);
}
}
Console output :
I got an app that only contains a webview, pointing to a site with a login screen. The users of the app should be able to get notifications, but only if they are authenticated (logged in to the site in the webview). Is there any way to tell if the user of the app is authenticated to the website in the webView? Any way for the app to know if the user clicks the login button in the webview?
I know that we can override OnReceivedHttpAuthRequest in a custom renderer, but this is not triggered by the login screen of this website so it doesn't work in this case.
Any suggestions?
Hello
I'd like to write a custom renderer for Android and iOS which places a button on a Tabbed Page below the page content (the button should be visible on every page). Could you give me some help because I don't know where to start (which methods do I have to override in the custom renderer? How to add an additional element in the customer renderer?
It would be great if someone of you could give me some help for the start
Thank you very much
when i call Web Api from Xamarin form i get correct Json response from the Api controller
but when i use [authorize] on the Api controller i get
using PostMan
Status : 401 Unauthorized
{ "Message": "Authorization has been denied for this request." }?
How to authenticate the request ?
Any help .
Thanks
public interface IBaseUrl { string Get(); }
public partial class PayMePage :ContentPage
{
public PayMePage()
{
InitializeComponent();
var browser = new WebView();
var htmlSource = new HtmlWebViewSource();
htmlSource.Html = @"<html>
<body>
<h1>Xamarin.Forms</h1>
<p>The CSS and image are loaded from local files!</p>
<img src='XamarinLogo.png'/>
<p><a href=""Paymepage.html"">next page</a></p>
</body>
</html>";
htmlSource.BaseUrl = DependencyService.Get<IBaseUrl>().Get();
browser.Source = htmlSource;
Content = browser;
}
}
I like to implement this code through WebViewClient
I'm changing my application now over to an MVVM structure. Just beginning to get the hang of it. And finding that I can now reuse code - which is great. I have a section of code where the user can select a stock product which I would use on several pages. E.g. on a stock query page - so user can see the price for the item. On a page where the user can add in a new bar code. On a page where the user can enter in a quantity on a stock take. So I've been able to create a VIEWMODEL which handles selecting the stock code and calling an API to read it in. I then add a grid onto a view which contains the fields - use the binding context for the grid to bind to the view model. So the only code I'm repeating is the XAML in my VIEW.
<Grid x:Name="GridStockSearch"
ColumnSpacing="5"
Padding="5,5,5,5" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Entry
x:Name="TxtStockCode"
Text="{Binding StockItem.StockCode}"
Grid.Row="0" Grid.Column="0"
Placeholder="Stock Code"
Completed="TxtStockCode_Completed"
/>
<Button x:Name="btnRead"
Image="Assets/read.png"
IsEnabled="{Binding IsNotBusy}"
Grid.Row="0" Grid.Column="1"
WidthRequest="50"
Command="{Binding StockReadCommand}" />
<Button x:Name="btnClear"
Image="Assets/delete.png"
Grid.Row="0" Grid.Column="2"
WidthRequest="50"
Command="{Binding ClearCommand}" />
<localeditor:CustomEditor
x:Name="TxtStockDesc"
Text="{Binding StockItem.StockDescription}"
Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
FontSize="Default"
VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
Placeholder="Description" >
</localeditor:CustomEditor>
<Button x:Name="btnSearch"
Text="?"
Command="{Binding StockSearchCommand}"
Grid.Row="1" Grid.Column="2"
WidthRequest="50" />
<ActivityIndicator
Grid.Row="2" Grid.Column="0"
IsRunning="{Binding IsBusy}"
IsVisible="{Binding IsBusy}"/>
</Grid>
In Code - I set the Binding Context in the constructor
InitializeComponent();
GridStockSearch.BindingContext = new StockSearchVM(() => TxtStockCode.Focus());
Two questions
1) Where should I be handling Text_Changed and Completed events - I'm currently doing it in my View. So if the user hits the "Done" button on the soft keyboard on the stock code field - the user had entered in the stock code and the code behind the read button should be run - this calls the API which reads the details for the stock item
private void TxtStockCode_Completed(object sender, EventArgs e)
{
// User has hit the completed button
//Call command within viewmodel to perform the command behind the read button
if ((GridStockSearch.BindingContext is StockSearchVM vm) && vm.StockReadCommand.CanExecute(null) && (!vm.IsBusy))
{
vm.StockReadCommand.Execute(null);
}
if (TxtStockCode.Text.Trim().Length == 0)
{
TxtStockDesc.Focus();
}
}
Should I be doing this in the View page??
2) When the details for the stock item is read in, I want to alert the view that there is a valid stock code and it can then go and do stuff - e.g. if on a stock query screen - it will display prices for the stock item. I'm currently using MessageCenter which I subscribe to within the constructor. On the viewmodel, I send the message. I had placed the subscribe within the OnAppearing and the unsubscribe within the OnDisappearing but found my messages were been subscribed multiple times.
a) Is the MessageCenter the best method for passing alerts between view and viewmodels
b) Where do I unsubscribe - or is the message subscription automatically unsubscribed when the page is removed from the navigation stack. My page is a "ContentPage" - I had seen a "Popped" event but this only relates to Navigation Pages.
Thanks as always
Ann
Hi all,
I don't even know where to start
Since alpha 2019.3 Unity offers the feature "Unity as a Library" https://blogs.unity3d.com/2019/06/17/add-features-powered-by-unity-to-native-mobile-apps/ which I'm currently trying to integrate into one of our Xamarin Apps.
There are descriptions how to do that natively for Android and iOS which I got both working fine.
Just for reference:
https://forum.unity.com/threads/integration-unity-as-a-library-in-native-ios-app.685219/
https://forum.unity.com/threads/integration-unity-as-a-library-in-native-android-app.685240/
This is actually a really big deal so it is great working on it
However, I got it working fine for Xamarin Android. Now I'm trying on iOS which appears to be much more complicated.
The unity project will be exported as a native Objective-C++ framework (I think at least as there are .mm files using Objective C)
When using Sharpie to bind the framework I get a super large APIDefinitions file.
After some research I figured out that I have to define a scope to the Headers of the Framework, then the APIDefinitions are in fact much smaller and only reference the header files.
Now to my (current) problem:
If I open the ApiDefinitions then there is an interface UnityFramewok which comes from the UnityFramework.h file.
But this header holds a reference to a class UnityView which is not part of the headers. It is within the framework( at least it is within the Library project in Xcode so I assume it is bundled into the framework.)
I copied the .framework into the bindings Native References but I can't see any actual change happening when I do that.
The UnityView can not be found within the interface and I also can't import it from the library because the native reference is not available.
So how can I reference to a class of the framework from within an interface that is defined in the ApiDefinitions?
Thank you already!
Hello,
I've created a listview of colors by iterating though the color object to get all the field names, I then bind the observablecollction to the listview and use a color converter to convert the color names to a valid color. This all works correctly and displays fine on iOS, however on Android the first 9 box views have the correct background color, but after that all the box view background are white.
There doesn't seem to be any warning or errors, and i'm confused as it's rendering correctly on iOS, has anyone ever came across a problem like this before? Thanks.
Sample of the binding below
<ListView x:Name="colorList" SeparatorVisibility="None" ItemsSource="{Binding Colors}" SelectedItem="{Binding SelectedColor, Mode=TwoWay}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
<BoxView BackgroundColor="{Binding ., Mode=TwoWay,Converter={StaticResource colorConverter}}"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Hi,
I am trying to add a custom menu for in webview's text selection. I am able to achieve the same in ios but in android, I will have to do it in mainAcitivity. I don't want to add to mainActivity as it will add the custom menu for all the webviews in the app, and I want only for one of the webview.
Note:
I am developing an app which has more than one webview and I want custom text-selection menu only for one webview.
Thanks in advance
Hello,
How to download a pdf file with progress bar in xamarin forms
"https://github.com/damienaicheh/XFDownloadProject"
I followed this link but i am not getting any pdf file in device
Thank you
I have defined a resource in App.xaml which am trying to read from a view model class.
Different versions which were tried:
<OnPlatform x:Key="HorizontalListHeight"
x:TypeArguments="x:Double">
<OnPlatform.Android>
<OnIdiom x:TypeArguments="x:Double"
Phone="250.0"
Tablet="375.0" />
</OnPlatform.Android>
<OnPlatform.iOS>
<OnIdiom x:TypeArguments="x:Double"
Phone="240.0"
Tablet="260.0" />
</OnPlatform.iOS>
</OnPlatform>
<OnPlatform x:Key="HorizontalTopicListHeight"
x:TypeArguments="x:Double">
<OnPlatform.Android>
<OnIdiom x:TypeArguments="x:Double"
Phone="150.0"
Tablet="150.0" />
</OnPlatform.Android>
<OnPlatform.iOS>
<OnIdiom x:TypeArguments="x:Double"
Phone="225.0"
Tablet="225.0" />
</OnPlatform.iOS>
</OnPlatform>
double height = (double)App.Current.Resources["HorizontalListHeight"];
horizontalStack.HeightRequest = height;
I am trying to read it and set the height request dynamically like,
But casting to double throws IllegalCastException, and at the same time, I am able to cast into the correct value from the watcher in VS.
Hi All,
Can any one please tell me How can I fetch Garmin data into my xamarin forms application.
Thank you in advance
I have used custom font family in my application, Next Arabic font family not works in iOS, working fine in android.
Code snippet:
<ContentPage.Resources>
<ResourceDictionary>
<OnPlatform x:TypeArguments="x:String" x:Key="NormalFont">
<On Platform="iOS" Value="Cocon® Next Arabic" />
<On Platform="Android" Value="NextArabic.otf#Cocon® Next Arabic"/>
</OnPlatform>
</ResourceDictionary>
</ContentPage.Resources>
. . .
`<StackLayout>`
`<Label Text="Hello" HorizontalTextAlignment="Center" VerticalOptions="CenterAndExpand" FontSize="20" FontFamily="{StaticResource NormalFont}"/>`
`<Label Text="Xamarin Forms" HorizontalTextAlignment="Center" VerticalOptions="CenterAndExpand" FontSize="25" FontFamily="{StaticResource NormalFont}"/> `
`<Label Text="Hellow Wrold" HorizontalTextAlignment="Center" VerticalOptions="CenterAndExpand" FontSize="20" FontFamily="{StaticResource NormalFont}"/>`
`</StackLayout>`
i have attached sample and images
android:
iOS
Hi,
I have a scenario where I have multiple HTTP connections to make simulataneously. It's been performing the requests very slowly so I've added a few log messages to the Output Window:
[0:] OPOCDebug 10:50:08.818: ViewJobViewModel SyncJob RFIs Add Task Start
[0:] OPOCDebug 10:50:08.833: SyncManager HandleExistingRfis Start
Thread started: #36
[0:] OPOCDebug 10:50:10.344: ViewJobViewModel SyncJob RFIs Add Task End
[0:] OPOCDebug 10:50:10.461: ViewJobViewModel SyncJob ExistingImageBanks Add Task Start
[0:] OPOCDebug 10:50:10.503: SyncManager HandleExistingImageBanks Start
[0:] OPOCDebug 10:50:10.606: RfiSyncService UpdateToServerAsync: 1.3395597s
Resolved pending breakpoint at 'RfiService.cs:207,1' to void OPOC.Prism.Standard.Data.Database.RfiService.d__9.MoveNext () [0x00142].
[0:] OPOCDebug 10:50:11.129: RfiSyncService UpdateToLocalAsync: 0.4949528s
[0:] OPOCDebug 10:50:11.156: SyncManager HandleExistingRfis End
Thread started: #37
[0:] OPOCDebug 10:50:12.033: ViewJobViewModel SyncJob ExistingImageBanks Add Task End
[0:] OPOCDebug 10:50:12.368: ViewJobViewModel SyncJob NewImageBanks Add Task Start
[0:] OPOCDebug 10:50:12.445: SyncManager HandleNewImageBanks Start
[0:] OPOCDebug 10:50:12.482: ImageBankSyncService UpdateToServerAsync: 1.9132596s
Resolved pending breakpoint at 'ImageBankService.cs:159,1' to void OPOC.Prism.Standard.Data.Database.ImageBankService.d__7.MoveNext () [0x00142].
[0:] OPOCDebug 10:50:13.078: ViewJobViewModel SyncJob NewImageBanks Add Task End
[0:] OPOCDebug 10:50:13.091: ViewJobViewModel SyncJob Pre Try
[0:] OPOCDebug 10:50:13.109: ViewJobViewModel SyncJob Pre WhenAll
[0:] OPOCDebug 10:50:13.508: ImageBankSyncService UpdateToLocalAsync: 0.9988966s
[0:] OPOCDebug 10:50:13.532: SyncManager HandleExistingImageBanks End
[0:] OPOCDebug 10:50:14.377: ImageBankSyncService AddBulkToServerAsync: 1.9011344s
Resolved pending breakpoint at 'ImageBankService.cs:255,1' to void OPOC.Prism.Standard.Data.Database.ImageBankService.d__10.MoveNext () [0x001cc].
[0:] OPOCDebug 10:50:14.763: ImageBankSyncService UpdateBulkLocalIdAsync: 0.3374065s
[0:] OPOCDebug 10:50:15.120: SyncManager HandleNewImageBanks End
[0:] OPOCDebug 10:50:15.144: ViewJobViewModel SyncJob Post WhenAll
[0:] OPOCDebug 10:50:15.294: ViewJobViewModel SyncJob Finally Start
[0:] OPOCDebug 10:50:15.887: ViewJobViewModel SyncJob Pre Check Dirty09-21 10:50:15.859 D/ViewRootImpl@8726934MainActivity: dispatchDetachedFromWindow
I realise that there's not much to go on without code but does anyone have any pointers as to why it appears that the time to start a Thread is so long?
See the gaps here:
[0:] OPOCDebug 10:50:08.833: SyncManager HandleExistingRfis Start
Thread started: #36
[0:] OPOCDebug 10:50:10.344: ViewJobViewModel SyncJob RFIs Add Task End
And
[0:] OPOCDebug 10:50:11.156: SyncManager HandleExistingRfis End
Thread started: #37
[0:] OPOCDebug 10:50:12.033: ViewJobViewModel SyncJob ExistingImageBanks Add Task End
After calling MobileBarcodeScanner - and either scanning a barcode or hitting the android back button from the scanner page, a call to Navigation.PopAsync will not work. The Android Back button will not exit the current page either. The current Page is the top element on the Navigation.NavigationStack - and that does not change.
I am using version 2.4.1 of ZXing and version 4.2.0.778463 of Xamarin.Forms
Is there any way to force the removal of that top page on the stack?
Code to call barcode scanner:
private async Task DoScan()
{
try
{
var options = new MobileBarcodeScanningOptions
{
AutoRotate = false,
UseFrontCameraIfAvailable = false,
TryHarder = true
};
var Scanner = new MobileBarcodeScanner();
if (Scanner != null)
{
var result = await Scanner.Scan();
if (result != null)
{
ScanResult.Text = result.Text;
}
}
}
catch (Exception Ex)
{
ScanResult.Text = $"Scan Error: {Ex.Message}";
}
}
Hi
I have a requirement for my Xamarin Forms app which is running on both IOS and Android.
I need to be able to stream the mobile camera to my server over rtsp as h264 and h265 encoded streams.
Currently I am streaming as mjpeg r http and I'm pulling out the frame and rotating it do that no matter the device orientation, the frame is always upright as that is also a requirement.
Does anyone know of any c# based API nuget packages I can use to implement this for both IOS and android devices please?
Thank you