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

i seriously need help

$
0
0

this is my situation.

I have an app written in Xamarin that supports both Droid and iOS. Each of these projects require platform independent Bluetooth API. So, what I've done is create an interface that I use with a DependencyService. The field I need is a list of Bluetooth Devices... this is simple enough if I'm developing for one platform. But in this case, my Bluetooth implementation "detects" devices on it own thread, so it's not necessarily possible for me to return a String[] Names.. My solution was this, I create a class and within the class have a String[] and since the class is a "reference" I assumed as I add to the list later in the code the changes would reflect in my DependencyService... but sadly, no, this is not the case..... Here's some code for the situation.

This is the definition of my class that I 'harbor' my array of items in.

namespace ThoughtCastRewrite.BluetoothX
{
    public class BluetoothItems
    {
        public string[] ListBTItems = new string[10];


        public BluetoothItems()
        {

            ListBTItems[2] = "TEST";
            ListBTItems[6] = "WtF?";
        }

        public void Set(string stringToAdd)
        {
            ListBTItems[4] = stringToAdd;


        }
    }
}

This bit of code is in the Cross-Platform project

BluetoothItems bluetoothItemList = DependencyService.Get<ISlateBluetoothItems>().IBluetoothTest;
listView.ItemsSource = bluetoothItemList.ListBTItems;

Now here is the Droid code:

 BluetoothItems bluetoothItems = new BluetoothItems();
 public BluetoothItems IBluetoothTest { get => bluetoothItems; }

Ok, so, this may seem obvious, but TEST and WtF? are added to my listview.
But, in my MainActivity (Droid portion again) after the entire view loads I call

 bluetoothItems.Set("TEST");

and the "TEST" item is never added to my list!

Am I being clear here about what I'm trying to do?

Any assistance is welcomed.


UWP Editor Alignment Issue

$
0
0

In UWP. The expected behavior is that upon setting the Editor text it is display aligned to the top, but no matter what I have tried is always aligned to the bottom. Yes, I have looked into every single forum and have not found anything closer to a solution. Alternatively is there any UI Library that provides one with this expected behavior I will like also to know about since I have not found any that offers an editor (again for UWP).

Can you help?

Ed.

Image not showing in Xamarin.UWP

$
0
0

Hi,
I'm trying to display a image with some data. I can able to display both image and data in Android where as in UWP only data is showing up, but not image. Do anybody have idea about that.

Thanks in Advance!

Change Navigation Tab in Android to different size

$
0
0

I have a xamarin forms app and when i view it in my android emulator the page title looks very large as shown below. Is there anyway I can reduce the size as in ios it looks much smaller and cleaner.

How to use FlexLayout in a MVVM framework?

$
0
0

I can fill a FlexLayout dynamically with labels from a collection in the code behind like that (labels are wrapped to several rows):

       foreach (WordItem item in _items)
        {
            Label label = new Label
            {
                Text = item.Name,
                Margin = new Thickness(2, 0, 2, 0),
                FontSize = 16,
                TextColor = Color.Black,
                BackgroundColor = Color.AliceBlue
            };

            flex1.Children.Add(label);
        }

But I can't imagine how to do it in a MVVM application (I'm using Prism/DryIoc). What would be the source property for binding dynamically several labels to the FlexLayout?
Every answer is appreciated!
Marc

Global Styles not working in iOS

$
0
0

I have the following global styles defined in app.xaml and applied on a content page (see attached). This works as expected in Android and UWP, but doesn't work in iOS. In Android and UWP the background is dark grey with a padding of 20. In iOS the background is white with no padding. None of the styles work at all in iOS, but the colors defined at the top do work in all platforms.

Is it possible to use Xamarin.Forms.Maps without the write access to external storage permission?

$
0
0

On GitHub [assembly: UsesPermission(Manifest.Permission.WriteExternalStorage)] is added on the assemblyinfo.cs of Xamarin.Forms.Maps.Android as seen here:
https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Maps.Android/Properties/AssemblyInfo.cs#L22

Is this absolutely required for functionality? Is there a way I can override it in my app? I've tried downloading the source-code, commenting the permission out, and adding the libraries Xamarin.Forms.Maps.Android.dll and Xamarin.Forms.Maps.dll to my Android project, but I must be missing something as the APK still asks for external storage access.

Can anyone please advise me on this?
Thanks

I am getting file path "/document/acc=1;doc=13" using Xamarin File Picker Plugin from android device


How Can I Use NavigationPage inside Tab (XAML)

$
0
0

Like this
h t t p s : / / ibb . co/k2NHt8
h t t p s : / / ibb . co/guvsRT

thnx in advance ;)

Xamarin.forms Image doesnt display when binded to URL from ViewModel

$
0
0

Hello!

I have a MVVM project in wich I want to display items on a ListView. every Item has an Image and a description. I thing this is a basic use case. The images are on Internet. My problem is when I hardcode the image's hyperlink directly on the XAML like this, it works well :
<ContentPage.Content>


<ListView.ItemTemplate>




But when I bind the Image to the hyperlinks from the ViewModel like this... :

...the images are not dislayed. The other binded data e.g: the Name, are well displayed with right values but not the images. Is it something I'm doing wrong?
FYI on the ViewModel, I simply hardcode the same hyperlink that was previous in the XAML. I tried a lot of thing resized, thy with image on the local machine etc. but got the same result. My page inherit from a BasePage that set the ViewModel as BindingContext and it works for the Name text. I verified the ItemsList collection at the runtime : the URLs and the names are there for every Items, but the Names are displayed, not the images.

Please help! :(

How to upload/download files from OneDrive in Xamarin Forms 3 App

$
0
0

I am developing an app with xamarin forms 3 where I need to upload and download files from OneDrive. I can't find any solution to this problem. I googled a lot but any solution based on Graph or Cloudrail API don't run. Is there ant good tutorial or code sample that solve this problem ? I can't believe that any others are in trouble like me. Thanks in advance to anyone can help me.

Can you set the ToolbarItem Text Color?

$
0
0

On Android, the default ToolbarItem text color is white, which does not contrast well against our background color. Is it possible to set the text color?

I've found several references to this same issue, but no answers.

ANNOUNCING: ComboBox and Floating Label Entry for iOS and Android

$
0
0

Hey folks, just wanted to let you all know that I've open sourced my Material Entry and AutoComplete (called ComboBox) today. Take a look and use it if you like.

note: only for Android and iOS at the moment
note: Android requires an AppCompat Theme

> Install-Package xfx.controls

The repo can be found on github

<xfx:XfxEntry Placeholder="Enter your name"
              Text="{Binding Name}"
              ErrorText="{Binding NameErrorText}" />


<xfx:XfxComboBox Placeholder="Enter your email address"
                Text="{Binding EmailAddress}"
                ItemsSource="{Binding EmailSuggestions}"
                SortingAlgorithm="{Binding SortingAlgorithm}"/>
// here's an example of how to do the SortingAlgorithm
public class MyViewModel : INotifyPropertyChanged
{
    public Func<string, ICollection<string>, ICollection<string>> SortingAlgorithm { get; } = (text, values) => values
        .Where(x => x.ToLower().StartsWith(text.ToLower()))
        .OrderBy(x => x)
        .ToList();
}

Changing Toolbaritem Text color

$
0
0

Hi,

How to change the toolbaritem text color. I have set this navigationPage.BarTextColor = Color.White; . It is working fine in iOS.. But it is shown black in Android.

Need help on this

Visual Studio emulator for Android not starting/deploying in VMWare Fusion on macOS Sierra

$
0
0

Has anyone got the VS emulator for Android working in any VM?

I've installed VS2017 15.7 on a VMware Fusion (latest version) running Windows 10 (latest version, latest updates) with virtual Hyper-V enabled.

I create a brand new project using the Xamarin Forms template.

I try to run it on any of the Visual Studio Android emulators and none seem to work.

The emulator starts up and seems functional.

However, Visual Studio just hangs and never seems to actually install the app onto the emulator. After a while if I click on the emulator to view the apps, i get a black screen in the emulator.

I can stop the build / deployment and Visual Studio is responsive.
Here is a similar post as to what is happening to me…
https://forums.xamarin.com/discussion/83756/visual-studio-android-emulator-black-screen-in-apps-periodically

The resolution in that post was to remove a line in the xdesku.xml file
https://creativewebspecialist.co.uk/2015/07/22/how-to-use-visual-studio-android-emulator-on-vmware-fusion/
(In Windows, you’ll need to edit the c:\program files (x86)\Microsoft XDE\10.0.10240.0\skus\android\xdesku.xml file and remove the following line from the file: GuestDisplayProvider=”VsEmulator.OpenGLGuestDisplay”)

I tried this, but still no luck.

I bumped the vm up to 10 gig and 4 processors, still no luck.

I have unchecked fast deployment in the visual studio iDE for Android properties. Also, in hyper-v I have selected processor compatibility and migrate to physical computer as well as 2 virtual processors for the emulators. These are usually the things that impact Android emulators from working correctly on the metal.

I am stumped. I am running the Visual Studio Emulator for Android. I even disabled 3D graphics as well as high res retina in the VM . I am getting runtime checks failed in deploying to the emulator.

The same test works fine on my Windows 10 desktop.

I can deploy to a physical device in the VM. And this is a hello world Xamarin Forms application. I just tried this with Parallels too, and have the same result. Also, while the VS for Android emulator is running, and I query the attached devices using "adb devices" in the ADB Command prompt, I get back an empty list in the VM. On the metal I get back an IP address of the emulator. Another clue I hope?


Webview (or) Zoomable image inside scroll view - Vertical zooming is not working in Android

$
0
0
    <ScrollView VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" x:Name="hello">
                      <Grid> 
                        <BoxView BackgroundColor="Red" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="10" HeightRequest="200"/>
                        <BoxView BackgroundColor="Black" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="10" HeightRequest="200"/>
                        <BoxView BackgroundColor="Yellow" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="10" HeightRequest="200"/>
                        <WebView HorizontalOptions="FillAndExpand" Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="10" x:Name="pdfviewer" HeightRequest="500" WidthRequest="500" VerticalOptions="Center" />
                        </Grid>
    </ScrollView>

Add custom logo in qr code xamarin forms

$
0
0

Hello,

I want to add custom logo in the qr code in xamarin forms.Can you please help me out.

How to bind Images to URI

$
0
0

Hello again. This is a second try for my previous discussion that degenerate because I didnt know how to quote code. I would like to delete it but I dont know how to do.

So, I have a MVVM project that aim to display items on a listview. Every item contain an image and a name. For now the image point to a picture on internet, but my goal is to let it point an image from my storage on the cloud. My problem is when I hardcode the hyperlink on the XAML as source for the Image tag, the images are displayed but when I assign the same link, hardcoded to a variable of the ViewModel and then bind the XAML image to that variable the images are not displayed, although the items names binds correctly.

here is the code that work : the I replaced the hyperlink by HYPERLINK :smile:

<ContentPage.Content>
    <StackLayout>
        <ListView ItemsSource="{Binding ItemsList}"
                  ItemSelected="OnItemSelected" x:Name="ItemsListView" HasUnevenRows="True">
            <ListView.ItemTemplate>
              <DataTemplate>
                <ViewCell>
                     <StackLayout>
                        <Image Source="HYPERLINK" HorizontalOptions="FillAndExpand" 
                        Margin="1,3,1,3" WidthRequest="40" HeightRequest="40"></Image>
                        <Label Text="{Binding Name}" FontAttributes="Bold" />
                        <Label TextColor="DeepSkyBlue" Text="{Binding Label}" />
                    </StackLayout>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
        </ListView>
    </StackLayout>
</ContentPage.Content>

And then when I replace HYPERLINK by the binding instruction below, images are not displayed :

<Image Source="{Binding ImageUri}" HorizontalOptions="FillAndExpand" 
                        Margin="1,3,1,3" WidthRequest="40" HeightRequest="40"></Image>

what I'm I doing wrong?
FYI my page inherit from a BasePage that set the ViewModel as BindingContext and the ItemList Collection is well initialised in that ViewModel. I checked in runtime that the Name and the URI are assigned for every Items. only the name is displayed, not the Image. so may be I dont bind the image correctly? how to do this well?

Thank you

Is this possible to make dynamic progress bar.

$
0
0


Hi Guys,

I am struggling to add dynamic progress bar with list view binding as horizontally view, also im attaching image ,please help me
advance thanks

Invalid value for property fontsize

$
0
0

I am setting fontsize in XAML like this :
FontSize="15"

Now changing the value works, font size changes.

So why I am getting a warning saying 'Invalid value for property fontsize'

Viewing all 91519 articles
Browse latest View live


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