I have a CollectionView which I want to use the minimum necessary width. The containing Grid has the following ColumnDefinitions:
<Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions>
And the code for the CollectionView is as follows:
<d:CollectionView.ItemsSource>
1
2
3
4
5
6
7
8
9
10
11
12
</d:CollectionView.ItemsSource>
<CollectionView.ItemTemplate>
Using the Minimum Width for CollectionView
How do l ressolve System.Net.WebException Error .The Internet connection appears to be offline
The project l am building has some images on a file storage site and its consuming api's and it connected to the internet via my phone.After a lot of research l found out it has a bit to do with my using cellular network. l tried following this guide https://docs.microsoft.com/en-us/xamarin/cross-platform/macios/http-stack but it did not resolve my issue. Kindly Assist
google drive in xamarin forms
Can ayone help hot to integrate google drive in xamarin forms
[Android] Enabling scrolling for a WebView inside a ScrollView
I had this problem a while ago and I didn't found a complete solution for this here in the forum so I'm posting a solution using a Custom Renderer that is very simple and worked very well for me and I bet that it should work for other components too. (Eg: ListView inside ScrollView, nested ScrollViews).
I hope others find it useful too.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
using Droid.CustomRenderers;
[assembly: ExportRenderer(typeof(WebView), typeof(ScrollableWebViewRendererAndroid))]
namespace Droid.CustomRenderers
{
public class ScrollableWebViewRendererAndroid : WebViewRenderer
{
public ScrollableWebViewRendererAndroid()
{
System.Diagnostics.Debug.WriteLine("ScrollableWebViewRendererAndroid()");
}
protected override void OnElementChanged(ElementChangedEventArgs<WebView> e)
{
base.OnElementChanged(e);
if (e.OldElement != null)
{
Control.Touch -= Control_Touch;
}
if (e.NewElement != null)
{
Control.Touch += Control_Touch;
}
}
void Control_Touch(object sender, Android.Views.View.TouchEventArgs e)
{
// Executing this will prevent the Scrolling to be intercepted by parent views
switch (e.Event.Action)
{
case MotionEventActions.Down:
Control.Parent.RequestDisallowInterceptTouchEvent(true);
break;
case MotionEventActions.Up:
Control.Parent.RequestDisallowInterceptTouchEvent(false);
break;
}
// Calling this will allow the scrolling event to be executed in the WebView
Control.OnTouchEvent(e.Event);
}
}
}
Does Xamarin.Forms have a replacement for UWP's RoutedEventArgs?
I am working on converting my apps from UWP to Xamarin.Forms. A large number of my event handlers' second parameter was of type RoutedEventArgs (or a descendant of it). I often used the Handled property of this to control which controls' events were triggered. I am still very new to Xamarin.Forms, but it seems like it uses EventArgs instead (in the GestureRecognizers), which does not include this property. Is there anything I can do to gain functionality similar to that provided by RoutedEventArgs in Xamarin.Forms? Thanks.
Facing error while using Plugin.Media.Abstractions.PickMediaOptions,System
Severity Code Description Project File Line Suppression State Suppression State
Error MSB4018: The "LinkAssemblies" task failed unexpectedly.
Mono.Linker.MarkException: Error processing method: 'System.Void ChallengeApp.Core.Services.AppServices.ImagePickerService/d__1::MoveNext()' in assembly: 'ChallengeApp.Core.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Threading.Tasks.Task`1<Plugin.Media.Abstractions.MediaFile> Plugin.Media.Abstractions.IMedia::PickPhotoAsync(Plugin.Media.Abstractions.PickMediaOptions,System.Threading.CancellationToken)
at Mono.Linker.Steps.MarkStep.HandleUnresolvedMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference)
at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
at Mono.Linker.Steps.MarkStep.ProcessQueue()
--- End of inner exception stack trace ---
at Mono.Linker.Steps.MarkStep.ProcessQueue()
at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
at Mono.Linker.Steps.MarkStep.Process()
at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
at Mono.Linker.Pipeline.Process(LinkContext context)
at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
at Xamarin.Android.Tasks.LinkAssemblies.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() 0
ViewCell Selected Background Color in iOS 13
Prior to iOS 13, you could set a background color in a ViewCell, and change that background color to another color when the cell is pressed. The color change would start on the press down and reset on release. The press feedback no longer works in iOS 13 if you use a cell background color other than transparent.
I need to use a cell background color to get the style I want in my app. Does anyone know a way to use a cell background color and get a touch effect in iOS 13 in a ListView? I've tried a number of approaches, but they all just capture the press release, not the press down. I did manage a workaround for cells in a TableView, but I still need help for cells in a ListView. Thanks!
Error Building iOS project on Xamarin Forms
Hi,
I am trying to build my iOS in my Xamarin Forms using Visual Studio for Windows but getting this error..
Kindly help...
Thanks,
Jassim
Custom base App Class
Hello all,
is there any way to derive the App class from a custom base class (of course that inherits from Xamarin.Forms.Application)?
I'm using visual studio and the autogenerated code in App.xaml.g.cs always refer to a global::Xamarin.Forms.Application no matter what I try to do?
Any advice?
How to play audio from byte[]
I would like to play audio from the byte[], that is being streamed.
How to Design Custom CollectionView with Grouping in XAML
I need to design the CollectionView with Header in XAML, how to do this?
HorizontalTextAlignment not working after 4.3.0.908675 update for android
After updating Xamarin.Forms to 4.3.0.908675 (or greater) from 4.2.0.910310, HorizontalTextAlignment = TextAlignment.Center no longer works for Entry views on Android. Labels and Pickers apparently, are not affected.
Any Ideas why?
Xamarin.forms Firebase analystics.
Hi,
I have implemented a firebase analytics tool in Xamarin. forms application and I am not able to track my custom event activity. Referred some tutorials based on implemented the Interface and firebase classes. Please help me out on how to track custom events.
var analyticsService = DependencyService.Get();
analyticsService.LogEvent("app_open", "content_type", "Login Attempted"); Event name , Paramater name , Value
Thanks,
Share from Xamarin Essentials mysteriously quit working after updates, but only on iPad on iOS13.2
I updated my iPad to 13.2, updated to latest XCode on my mac, updated VS, updated to XF 4.3.
I know, not smart.
Everything appeared to work, until I tried the SHARE function of my app on iPad. The pop-over does not appear. An older version of my app works OK, and the new version works OK on my iPhone running 13.1.3.
I did try rolling back XF to what I was using (since it was easy), no help there.
Oh, and well there's another part to this mystery. To share multiple files, I wrote my own code using the iOS api, including creating an Activity Vew Controller (the pop-over). This doesn't work either.
Is there some kind of iPad settings or Info.plist thing I'm missing here? Got me very confused.
how do i create a cross platform social media(ios and android)photo feed in xamarin.forms
i want to create a efficient photo feed in which i will be loading information from firebase database such as username, the photo url, likes, comments, and description and want to make a photo feed that acts as kinda a recycler view for its efficiency. and I do not know how at all
Triggering binding in other binding
Hi guys , I have a picker and button .I want to set button visibilty after picker selected. Seems like OnSelectedChanged action of picker can not be bind to a command . i have already binding for SelectedItem property so i thought i can use this for make button visible. It is working but there is a problem : Button visibilty doesnt changing after picker first selection time. After 1. selection if i select other thing on picker it is changing.
This is my code :
// MVVM part
public bool IsLevelSelected {
get { return _isLevelSelected; }
set
{
_isLevelSelected = value;
OnPropertyChanged(nameof(IsLevelSelected));
}
}
public string SelectedLevel
{
get
{
return _selectedLevel;
}
set
{
IsLevelSelected = true;
_selectedLevel = value;
OnPropertyChanged(nameof(SelectedLevel));
}
}
//XAML
<Picker x:Name="picker" Title="Seviye seçiniz" FontAttributes="Bold" FontSize="Large" Margin="0,50,0,0"
SelectedItem="{Binding SelectedLevel}" HorizontalOptions=" >
<Button Text="{Binding SelectedLevel,StringFormat='{0}. Leveli Başlat'}" d:Text="1.ci Leveli Başlat"
Command="{Binding StartGame}"
HeightRequest="100" Margin="20,40,20,20"
BorderWidth="5" BackgroundColor="DarkKhaki"
IsVisible="{Binding IsLevelSelected}"
CornerRadius="25" CommandParameter="{Binding SelectedLevel}"
open Webview links in external Browser if target is set to _blank
Hi,
i know how to open links in the external browser, but i want to do it only if the target of the link is set to _blank.
Any idea how to do that?
Thanks
Helge
Is there a way to hide Tab inside Shell TabBar?
I have an application where I want to display a Tab
called Upgrade when users have not paid for a subscription and never show the Tab
when they are paid users.
I have tried to find an IsVisible
property but can't... the closest thing to what I want is IsEnabled
but it leaves a blank space in the location of the now insvisible Tab
.
Does anyone know how I can achieve this? Or perhaps a better way to reach my object... thanks in advance!
What can I put into the blue area at top of app?
There's a blue rectangle above my first control in my pages. My question is whether I can put things, for example a menu or picture. Also, what is this are called? Here, the Xaml for my opening page (the blue rectangle is above the label with the text "Welcome to Rodney Pix":
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:TestXamarinFormsProject"
x:Class="TestXamarinFormsProject.MainPage">
<ScrollView>
<StackLayout x:Name="sl" Orientation="Vertical">
<Label Text="Welcome to Rodney Pix" HorizontalOptions="Center"
VerticalTextAlignment="Start" VerticalOptions="Start"></Label>
<ListView x:Name="lstDirectories" ItemTapped="LstDirectories_ItemTapped"
SelectedItem="{Binding SelectedListItem,Mode=TwoWay}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Padding="5" Orientation="Horizontal">
<Label Text="{Binding FriendlyDirectoryName}" TextColor="Black"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ScrollView>
How to find the child controls from StackLayout dynamically ?
I am using Xamarin.Forms (PCL project). I have created the stacklayout with some child controls. How can I get any control from this stacklayout dynamically (like findbyName , findbyID or Type) ?