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

Chat Application

$
0
0

Hi guys,

I'm trying to create a chat application on Xamarin Forms. I've been having problems with the UI. I have created a Renderer for the ViewCell however I've been having a problem with placing the Entry under the list. When the keyboard is open the list does not scroll up like it should.

1) Does anyone have a good Xamarin Forms chat example where the entry is at the bottom?
2) If I decide to implement the whole view natively for IOS and Android, can I bind the button to the ViewModel? How do I set the 'Command' property to a UIButton?

Thanks
Shaun


How to use System.Security.Cryptography?

$
0
0

More specifically I need to use this class DESCryptoServiceProvider in order to handle DES decryption.. any ideas?

Xamarin forms StackLayout strange exception

$
0
0

Hello everyone, i found something strange in my application, in 1/30 (ios) and 1/1000 (android) i got strange exception in this 2 lines :

StackLayoutName.Children.Insert(StackLayoutName.Children.IndexOf(elementToRemove), temp);                               
    StackLayoutName.Children.Remove(elementToRemove);

I checked everything, no nulls in variables, no index out of range, no any mistake that i can't found, but i get exception.
Can anyone help me with it?

Сообщение: Object reference not set to an instance of an object
Тип: System.NullReferenceException
  at Xamarin.Forms.BindableObject.GetContext (Xamarin.Forms.BindableProperty property) [0x00013] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\BindableObject.cs:489 
  at Xamarin.Forms.BindableObject.GetValue (Xamarin.Forms.BindableProperty property) [0x0000e] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\BindableObject.cs:54 
  at Xamarin.Forms.Layout.get_Padding () [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Layout.cs:84 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00027] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Layout.cs:111 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\VisualElement.cs:527 
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x00236] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\StackLayout.cs:185 
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\StackLayout.cs:110 
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\StackLayout.cs:67 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\VisualElement.cs:593 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\VisualElement.cs:469 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Layout.cs:110 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\VisualElement.cs:527 
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\StackLayout.cs:150 
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\StackLayout.cs:110 
  at Xamarin.Forms.StackLayout.OnSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00019] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\StackLayout.cs:67 
  at Xamarin.Forms.VisualElement.OnMeasure (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\VisualElement.cs:593 
  at Xamarin.Forms.VisualElement.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00053] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\VisualElement.cs:469 
  at Xamarin.Forms.Layout.GetSizeRequest (System.Double widthConstraint, System.Double heightConstraint) [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Layout.cs:110 
  at Xamarin.Forms.VisualElement.Measure (System.Double widthConstraint, System.Double heightConstraint, Xamarin.Forms.MeasureFlags flags) [0x00054] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\VisualElement.cs:527 
  at Xamarin.Forms.StackLayout.CalculateNaiveLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, Xamarin.Forms.StackOrientation orientation, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint) [0x000a8] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\StackLayout.cs:150 
  at Xamarin.Forms.StackLayout.CalculateLayout (Xamarin.Forms.StackLayout+LayoutInformation layout, System.Double x, System.Double y, System.Double widthConstraint, System.Double heightConstraint, System.Boolean processExpanders) [0x00058] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\StackLayout.cs:110 
  at Xamarin.Forms.StackLayout.LayoutChildren (System.Double x, System.Double y, System.Double width, System.Double height) [0x0005b] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\StackLayout.cs:44 
  at Xamarin.Forms.Layout.UpdateChildrenLayout () [0x000c7] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Layout.cs:229 
  at Xamarin.Forms.Layout.OnSizeAllocated (System.Double width, System.Double height) [0x0000f] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Layout.cs:194 
  at Xamarin.Forms.VisualElement.SizeAllocated (System.Double width, System.Double height) [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\VisualElement.cs:629 
  at Xamarin.Forms.Layout.ForceLayout () [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Layout.cs:104 
  at Xamarin.Forms.Layout.InvalidateLayout () [0x00016] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Layout.cs:174 
  at Xamarin.Forms.Layout.OnInternalAdded (Xamarin.Forms.View view) [0x0002d] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Layout.cs:404 
  at Xamarin.Forms.Layout.InternalChildrenOnCollectionChanged (System.Object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00089] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\Layout.cs:392 
  at (wrapper delegate-invoke) <Module>:invoke_void_object_NotifyCollectionChangedEventArgs (object,System.Collections.Specialized.NotifyCollectionChangedEventArgs)
  at System.Collections.ObjectModel.ObservableCollection
1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedEventArgs e) [0x00012] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:288
at System.Collections.ObjectModel.ObservableCollection
1[T].OnCollectionChanged (System.Collections.Specialized.NotifyCollectionChangedAction action, System.Object item, System.Int32 index) [0x00000] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:351 
  at System.Collections.ObjectModel.ObservableCollection
1[T].InsertItem (System.Int32 index, T item) [0x00024] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:219
at System.Collections.ObjectModel.Collection
1[T].Insert (System.Int32 index, T item) [0x00038] in /Users/builder/data/lanes/3818/ad1cd42d/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/collections/objectmodel/collection.cs:103 
  at Xamarin.Forms.ObservableWrapper
2[TTrack,TRestrict].Insert (System.Int32 index, TRestrict item) [0x00032] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\ObservableWrapper.cs:117
at Application.UI.Menu.TestPage+d__11.MoveNext () [0x00640] in C:\Projects\Application.UI.Menu.TestPage.cs:303
`

ScrollView position resets after resizing layout when running on iOS

$
0
0

I've got a problem with a Forms app when running on iOS. I have a scrollview on a page along with an entry box at the bottom of the page that is always supposed to visible. The scrollview scrolls a list independently of the entry box and that all works fine.

The problem is the keyboard on iOS.

I have some code that resizes the page using LayoutTo when the keyboard appears so that the list and the entry are still visible. The problem is that this resets the scroll position to the top. Any ideas how I can preserve the scroll position?

Also under some conditions I want to scroll to the end after dismissing the keyboard but following the automatic scroll to top my call to ScrollToAsync doesn't do anything.

Any ideas? Thanks.

How to store image path in sqlite database and image in local storage or file system ?

$
0
0

Can anyone tell me how to store image path in sqlite database using xamarin forms and also how to retrive that image source ?? Please Reply

Early Preview of Exrin

$
0
0

Hi All, I wanted to share the first release of an open source project I have been working on for a few months. Summary: Its a mobile app framework for Xamarin Forms meant for larger projects or ones where stability and performance are needed.

I really don't want to call it another MVVM framework, I so desperately didn't want to create another one and it never started that way, its more than that, but it does stand on its own without any MVVM framework because it was just easier adding in the final few parts so you didn't need to add any in.

Links to full docs, sample app, nuget and source code all below.

http://www.xamarinhelp.com/early-preview-exrin/

Feedback welcome, even if its oh no not another one :) It just kept niggling away at me until I created it as I kept facing the same problems with each XF project I started and copying code across each time when it should have just been in a framework.

Store image in Internal Storage Memory

$
0
0

I want to Store Captured Image in Phone Internal storage How can i do this? Please help me.

Signature Pad for Xamarin.forms

$
0
0

Hi.
I want to know how to use signature component for Xamarin.forms project.

https://components.xamarin.com/view/signature-pad

Is this different with SignaturePad.Xamarin.Forms.PCL?

I have add SignaturePad.Xamarin.Forms.PCL package to my xamarin.forms project and made xaml file like this.

<ContentView 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    xmlns:acr="clr-namespace:Acr.XamForms.SignaturePad;assembly=Acr.XamForms.SignaturePad"
    x:Class="Smartdocs.SignatureView"
    BackgroundColor="#f2f9fc"
    >
    <ScrollView>
        <StackLayout>
            <acr:SignaturePadView
                x:Name="padView"
                HeightRequest="320"
                WidthRequest="240"
                BackgroundColor="White"
                CaptionText="Caption This"
                CaptionTextColor="Black"
                ClearText="Clear Me!"
                ClearTextColor="Red"
                PromptText="Prompt Here"
                PromptTextColor="Red"
                SignatureLineColor="Aqua"
                StrokeColor="Black"
                StrokeWidth="2"
            />
        </StackLayout>
    </ScrollView>
</ContentView>

What else do I have to do?

I am looking forward your help.

Kind Regards.


FacebookClient not being added to Xamarin.forms

$
0
0

Hi,

I am trying to share a link on Facebook via my app. In order to achieve the same I tried using Xamarin.Facebook but this does not have FacebookClient class associated to it.How and what can be done to share link over Facebook in Xamarin.Forms for android and IOS.

P.S- I don't want to get the share dialog(Xamarin.Share) having other options to share too.After authentication in Facebook the post status dialog of facebook should be displayed .

Any suggestions??

MVVMFresh - How to set a NavigationPage Title Icon ?

Margin is not applied for converted view.

$
0
0

In xamarin.Forms, we are creating a grid and setting margins. This Grid layout is converted into native views for Android and iOS like mentioned in the link. From this we are getting native view and the margin that i have applied in xamarin View is not applied to native view. Is this a bug.?

Note: I have been using padding also which is working fine.

ListView taking up too much space on page, not autosizing to cells

$
0
0

Hi, I'm very new to Xamarin.Forms and I'm having some issues with ListViews.
I have a very basic page in my app that just displays a bunch of info grabbed from a WPF Service, everything works fine apart from the ListView that is there to display an inventory of items. There are usually 2-5 items, but the ListView space stretches far beyond that, pushing everything else off the bottom of the page.

I understand that ListViews should not be used with ScrollViews. I do have one on the page, but the issue still occurs if I remove it, so it seems to be something else.

Here is the relevant XAML, simplified to highlight just the problem area:

    <Grid x:Name="InnerGrid" Grid.Row="1">
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="Auto"/>
        <ColumnDefinition Width="Auto"/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
      </Grid.RowDefinitions>

      <Label x:Name="titleInfo" Grid.ColumnSpan="2" Grid.Row="0" FontSize="40"  HorizontalTextAlignment="Start"/>
      <Image x:Name="imageInfo" Grid.ColumnSpan="2" Grid.Row="1" Source="{Binding Image}"  HorizontalOptions="Center"/>
      <Label x:Name="equipmentText" Grid.Column="0" Grid.Row="2" FontSize="20" HorizontalTextAlignment="Start"/>

      <ListView x:Name="equipmentInfo" Grid.Column="1" Grid.Row="2" ItemsSource="{x:Static local:ViewRoom.equipment}" 
                ItemTapped="equipmentInfo_Tapped" HasUnevenRows="True">
        <ListView.ItemTemplate>
          <DataTemplate>
            <ViewCell>
              <RelativeLayout>
                <StackLayout VerticalOptions="FillAndExpand">
                  <Grid>
                    <Label Text="{Binding Item}" FontSize="18" LineBreakMode="WordWrap"/>
                  </Grid>
                </StackLayout>
              </RelativeLayout>
            </ViewCell>
          </DataTemplate>
        </ListView.ItemTemplate>
      </ListView>
      <!--The huge gap is here-->
      <Label x:Name="locationLabel" Grid.Column="0" Grid.Row="3" FontSize="20"/>
      <Label x:Name="locationText" Grid.Column="1" Grid.Row="3" FontSize="18"/>
</Grid>
      ...etc

Any thoughts? I've had a look around the forums and StackOverflow and haven't found any solutions that have worked as of yet.
Thanks in advance! :)

Is it possible to change the texts on a Xamarin Switch

$
0
0

Can I change a text on a Xamarin switch?

How to add pull to refresh in xamarin forms list view?

$
0
0

Hello I'm totally new to xamarin and MVVM concepts, I don't know how to add pull to refresh for a list view in Xamarin forms.
I don't know where to start adding the command and refresh functions to populate data. I have attached my xaml and view model file. Can anyone help me please.

xamarin form - label stringformat in resourcefile

$
0
0

is it possible to have the format string in a resource file like the following?

<Label x:Name="lblName" Text="{Binding GivenName, StringFormat='x:Static resx:AppResources.lbl_format'}" Style="{StaticResource PersonalDetailsLblName}" />

resx/AppResources.resx

<data name="lbl_format" xml:space="preserve">
        <value>Hi {0}</value>
      </data>

my expected label text is 'Hi '

but what i get when running emulator the label text = x:Static resx:AppResources.lbl_format


In Xamarin Forms, how can I show a web image in the same way as a image in the resource folder?

$
0
0

I have a Xamarin forms image where I want to show images from the web, kind of like in a facebook style feed. Due to bandwidth concerns, I do not want to serve high resolution images from my web server.

Now if I add a Image with the Source attribute set to my image url, I cannot get the image to display larger than what it is in native resolution (at least on iOS where I am testing now). This means that to display the image at full width on the later iPhones I need to have a image wider than 1000px.

Is there any way I can make the web images behave more like the images loaded from the resource directory, that are scaled up on higher resolution devices?

Not sure how to explain this in a good way, this repo (not mine) addresses the same problem: https://github.com/williamwilling/xamarin-forms-image-size . Probably not a bug in Xamarin forms I would guess, more a behavior.

Note: I only need this to work on iOS and Android.

This question is also on StackOverflow: http://stackoverflow.com/questions/40014413/in-xamarin-forms-how-can-i-show-a-web-image-in-the-same-way-as-a-image-in-the-r

ModernHttpClient TLS 1.2 Android API 19

$
0
0

I have to get data from a server that is using TLS 1.2. I've been able to acquire the data on iOS using ModernHttpClient

By default TLS 1.2 support is not enabled on Android devices running API 19 or older. There are ways to enable TLS 1.2 support by overriding the socket creation then passing the socket to the client. Unfortunately, I am completely at a loss on how to do that. It looks like it needs to be handled in the .Droid project itself. I suppose I'll have to handle all the HttpClient requests in the Droid project as a dependency service?

UWP Global ListViewItem style doesn't take effect.

$
0
0

Hi,

I noticed in Xamarin Forms UWP, the default ListViewItem style is really bad. I attempted to fix it by applying a global style, but it does not take effect. To test, I also created a sample project in Blend. With the same style applied in both projects, you can see the one in blend (not xamarin forms) has the style taking effect correctly, while Xamarin Forms seems to completely ignore the style.

The style:

    <Style TargetType="ListViewItem">
        <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
        <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
        <Setter Property="Background" Value="{ThemeResource ListViewItemBackground}"/>
        <Setter Property="Foreground" Value="{ThemeResource ListViewItemForeground}"/>
        <Setter Property="TabNavigation" Value="Local"/>
        <Setter Property="IsHoldingEnabled" Value="True"/>
        <Setter Property="Padding" Value="12,0,12,0"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="MinWidth" Value="{ThemeResource ListViewItemMinWidth}"/>
        <Setter Property="MinHeight" Value="{ThemeResource ListViewItemMinHeight}"/>
        <Setter Property="AllowDrop" Value="False"/>
        <Setter Property="UseSystemFocusVisuals" Value="True"/>
        <Setter Property="FocusVisualMargin" Value="0"/>
        <Setter Property="FocusVisualPrimaryBrush" Value="{ThemeResource ListViewItemFocusVisualPrimaryBrush}"/>
        <Setter Property="FocusVisualPrimaryThickness" Value="2"/>
        <Setter Property="FocusVisualSecondaryBrush" Value="{ThemeResource ListViewItemFocusVisualSecondaryBrush}"/>
        <Setter Property="FocusVisualSecondaryThickness" Value="1"/>

    </Style>

I have attached two screen shots, the one which looks ugly in Xamarin Forms, and the one which looks nice (created in Blend)

Bad:
image

Good:
image

Is there any way to get Xamarin Forms UWP project to respect the style? Is this a bug?

Thanks

Invalid value for slider minimum

$
0
0

Hello,

i'm trying to set a minimum value for a slider:

Slider slider = new Slider
{
    Minimum = 30.0,
    Maximum = 60.0,
    Value = 45.0
};

This results in an exception:

System.ArgumentException: Value was an invalid value for Minimum

Parameter name: value

I can set the minimum without problems to zero or a negative value, but a value greater than zero throws the error.

Is this working as intended or a bug?

Regards,
Dirk

TableSection title not shown

$
0
0

Hi,

I Used following code to create a table with two table sections:

            var section = new TableSection("Ring")
            {
                new SwitchCell {Text = "New Voice Mail"},
                new SwitchCell {Text = "New Mail", On = true}
            };
            var section2 = new TableSection("Ring2")
            {
                new SwitchCell {Text = "New Voice Mail"},
                new SwitchCell {Text = "New Mail", On = true}
            };

            var table = new TableView
            {
                Root = new TableRoot
                        {
                            section,
                            section2
                        },
                Intent = TableIntent.Settings,
            };

The TableSection titles "Ring" and "Ring2" are not shown, just an empty line. The SwitchCells are shown correctly.
I created a new project as mine( Forms Shared) and tested this code, and it works fine.
It must be something wrong with my app. i tried to create this in several ContentPages in my app, but it doesnt work.
I hope someone can give me a tip, which brings me on the right way.

Its only an android. on iOS device it works fine.

Viewing all 81910 articles
Browse latest View live


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