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

Xamarin Forms listview overlapped text iOS problem

$
0
0

Hello everyone,

I'm facing an issue with a listview.
The problem it's shown only on iOS.
When a scroll my listview the newest viewcell get overlapped by other text data.
Can anyone explain this, please :) ?
On Android there is no problem.

Thanks


How to customize ToolBarItems in xamarin.forms?

$
0
0

I want to add a badge icon in ToolBarItem so how to add a badge icon? And I want to also use circular profile image in ToolBarItem so how to do that?

Xamarin Forms iOS switch renderer null reference exception

$
0
0

I have a xamarin forms switch , when it is toggled getting the following exception on ios version only:

{System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Forms.Platform.iOS.SwitchRenderer.OnElementToggled (System.Object sender, System.EventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\SwitchRenderer.cs:78
at (wrapper delegate-invoke) System.EventHandler`1[Xamarin.Forms.ToggledEventArgs].invoke_void_object_TEventArgs(object,Xamarin.Forms.ToggledEventArgs)
at Xamarin.Forms.Switch+<>c.<.cctor>b__21_0 (Xamarin.Forms.BindableObject bindable, System.Object oldValue, System.Object newValue) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Switch.cs:14
at Xamarin.Forms.BindableObject.SetValueActual (Xamarin.Forms.BindableProperty property, Xamarin.Forms.BindableObject+BindablePropertyContext context, System.Object value, System.Boolean currentlyApplying, Xamarin.Forms.Internals.SetValueFlags attributes, System.Boolean silent) [0x00120] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:463
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes, Xamarin.Forms.BindableObject+SetValuePrivateFlags privateAttributes) [0x00173] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:397
at Xamarin.Forms.BindableObject.SetValueCore (Xamarin.Forms.BindableProperty property, System.Object value, Xamarin.Forms.Internals.SetValueFlags attributes) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\BindableObject.cs:343
at Xamarin.Forms.Element.SetValueFromRenderer (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:250
at Xamarin.Forms.Element.Xamarin.Forms.IElementController.SetValueFromRenderer (Xamarin.Forms.BindableProperty property, System.Object value) [0x00000] in D:\a\1\s\Xamarin.Forms.Core\Element.cs:246
at Xamarin.Forms.Platform.iOS.SwitchRenderer.OnControlValueChanged (System.Object sender, System.EventArgs e) [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Renderers\SwitchRenderer.cs:73
at UIKit.UIControlEventProxy.Activated () [0x00004] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIControl.cs:38
at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:86
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/13.18.2.1/src/Xamarin.iOS/UIKit/UIApplication.cs:65
at WeCareMobility.iOS.Application.Main (System.String[] args) [0x00002] in /Users/user/Desktop/Vipin/Copiloto/Mobile/WeCareMobility/WeCareMobility.iOS/Main.cs:20 }

Xaml:

 <Switch Grid.Row="0" Grid.Column="1" Margin="{OnPlatform Android='0,0,25,0',iOS='0,0,0,8'}" Scale="{OnPlatform iOS= '0.7'}" VerticalOptions="Start" HorizontalOptions="FillAndExpand" IsToggled="False" Toggled="Switch_Toggled" />

CS:

private void Switch_Toggled(object sender, ToggledEventArgs e)
{
// Perform an action after examining e.Value
if (e.Value)
{
App.Current.MainPage = new NavigationPage(new FlyoutPage());
_weCareStorageService.SetToggleValue(true);
}
}

I do not have any renderer for switch. It is working fine for android.
Upgraded to latest xamarin forms stable version 4.7.0.1080.
Using VS2019 mac. iOS sdk version:13.18.2.1 .
Cleaned,rebuilt. Still crash occurs in ios. Need some help...

Centered Fixed Marker on Xamarin.Forms.Maps

$
0
0

I'm trying to integrate a map on Xamarin.Forms that when opened, a fixed marker is placed on the center of the map. By fixed, I mean it does not move when the map is dragged and the marker itself is also not draggable. Can somebody guide me through this or do you have any reference that I can read on? I already have the map displayed. Thanks!

Binding entry to label in listview

$
0
0

I fill a Listview from a firebase database , no problem there .

But is it possible to bind 1 label in that listview to a Entry ?
The Entry with the name ""Keuze" . The text in the Entry is not coming from the database but the user is filling this in on the page.

When they filled in the Entry i load the listview

I Want to bind it to this Label in the Listview

   <Label Grid.Row="0"
                           Grid.Column="1"
                               HorizontalOptions="Center"    
                        **   Text="{Binding Adres}"**
                                    TextColor="#302C2C"
                           VerticalOptions="Center" />

 <ListView   AbsoluteLayout.LayoutBounds=".15,.55,.95,.70" AbsoluteLayout.LayoutFlags="All" 
                 BackgroundColor="Transparent"
                   ItemSelected="lstBal_ItemSelected"
         ItemsSource="{Binding Adresclub}"
      x:Name="lstBal"
                 IsPullToRefreshEnabled="False"
          HasUnevenRows="true"
                 Footer=""
                    Margin="20"
            HorizontalScrollBarVisibility="Always"
                                VerticalScrollBarVisibility="Default">
            <ListView.ItemTemplate>
                <DataTemplate>
                    <ViewCell>

                        <Grid Padding="30">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                  <ColumnDefinition Width="Auto" />

                            </Grid.ColumnDefinitions>
                            <Image Grid.RowSpan="2"
                           Source="{Binding Tegenstander}"
                           Aspect="AspectFit"
                                   HorizontalOptions="Center"
                           HeightRequest="50"
                           WidthRequest="50">

                            </Image>                   

                            <Label Grid.Row="0"
                           Grid.Column="1"
                               HorizontalOptions="Center"    
                           Text="{Binding Adres}"
                                    TextColor="#302C2C"
                           VerticalOptions="Center" />

                              <Label Grid.Row="2"
                           Grid.Column="1"
                                  HorizontalOptions="Center"     
                           Text="{Binding Voetbal}"
                                     FontAttributes="Bold"
                                    TextColor="#302C2C"
                           VerticalOptions="Center" />


                        </Grid>
                    </ViewCell>
                </DataTemplate>
            </ListView.ItemTemplate>
        </ListView>

Having issues with Xamarin.Essentials.SMS

$
0
0

Hi, I have come across an issue where when using XE SMS, if the user selects Facebook Messenger to send the created SMS message, the FBM app fails to load & the SMS fails to send. Is there a way to avoid giving the user an option on SMS client and go straight to the system default?

Thanks!
Pat

Implementation of Auto Slider for Carousal View Xamarin Forms

$
0
0

Need your help in Implementation of Auto Slider for Carousal View Xamarin Forms . Views should slide with some interval configured

How to get row and column from tapped item in Grid ?

$
0
0

I've got a simple 2x5 Grid to which I add Images in each 'cell'.

Each image has a TapGestureRecognizer attached and I add them to the Grid using:

grid.Children.Add(tmpImage, xCol, xRow);

Is there a way to get the xCol and xRow value when a user taps the image(s) ?


Custom List from other list

$
0
0

Hi friends, how are things going there?

I'm new in XF and I'm facing a issue that I'm not able to solve alone.

I need to create a custom List from other to use in picker.itemsource. When I use the original List it brings all columns (Name, Address, Phone etc.) from that list, but I need just the Names, do you know?

I want to use this value as parameters to a complex search screen (see attached image). I'm using just an entry field but I want to avoid the user commit some mistake while using the search, does it make sense?

Any help will be appreciated.

Thanks and best regards.

Remove all border but bottom on an Entry

$
0
0

Can I have an entry just with bottom border like this image?

I know you can do it with a Custom Renderer, but how? Can someone have a solution?

Page pushed pop at one click but on second click pushed twice and take two back button

$
0
0

Page take push first time and pop at one click but on second pushed the same page open twice and take two back button(pop). And if I pressed two time back and again open view it gets pushed 3 times and take three back button to return to home. And it keeps adding more pages and pops.

Text value doesn't display until Entry control is clicked

$
0
0

A TabbedPage contains multiple ContentPages. A few controls on one of these ContentPages are databound to an object property called SelectedCourse in MyPageModel. MyPageModel implements INotifyPropertyChanged and is assigned to the BindingContext of the ContentPage.

          <ContentPage.BindingContext>
                <local:MyPageModel/>
          </ContentPage.BindingContext>

When the ContentPage opens it should display the course details that are retrieved by the constructor of MyPageModel.

    public MyPageModel()
    {
        GetCurrentCourseAsync();            
    }

    private Course selectedCourse;
    public Course SelectedCourse
    {
        get => selectedCourse;
        set
        {
            selectedCourse = value;
            NotifyPropertyChanged("SelectedCourse");
        }
    }

    private async void GetCurrentCourseAsync()
    {
        var course = await courseRepo.GetCourseAsync();
    SelectedCourse = course;
    }

The data-bound values for the Picker and DatePicker controls display fine, but none of the Entry controls display a text value until I physically click on the control itself, and then the data appears in the control. I'm not sure why this is happening or what I need to do to refresh the UI so that these data-bound Entry controls display their data when the ContentPage is first opened?

What Mac is required for building against iOS?

$
0
0

I don't have any knowledge whatsoever about Apple machines but I need to develop apps to run on Apple smartphones/tablets, too.

What is the minimum requirement for a Mac machine I need to buy to be able to develop for against iOS? Is there a certain feature set that must be fulfilled by the machine?

BindableProperty does not change even binded property changed

$
0
0

Flow

  1. OnSizeAllocated execute a command.
  2. On command, change MangoBox.RatioX value.
  3. When MangoBox Changed, MangoBox raises RaisePropertyChanged.
  4. I expect BaseLayerView.OnMangoBoxChanged will be executed.

However, step 4 only executed once when initialize and bind BaseLayerViewModel.

I checked changing MangoBox property does execute RaisePropertyChanged, but BaseLayerView.OnMangoBoxChanged does not executed.

View

public abstract class BaseLayerView<T> : MvxContentView
    {
        public static readonly BindableProperty MangoBoxProperty =
            BindableProperty.Create(
                propertyName: nameof(MangoBox),
                returnType: typeof(MangoBox),
                declaringType: typeof(BaseLayerView<T>),
                defaultValue: null,
                propertyChanged: OnMangoBoxChanged);

        public MangoBox MangoBox
        {
            get => (MangoBox)GetValue(MangoBoxProperty);
            set => SetValue(MangoBoxProperty, value);
        }

        static void OnMangoBoxChanged(BindableObject bindable, object oldValue, object newValue)
        {
            if (newValue is null) { return; }
            var baseLayerView = (BaseLayerView<T>)bindable;

            // code i want to execute when `MangoBox` changed.
        }
    }

I bind BaseLayerView and BaseLayerViewModel by DataTemplate.

    <DataTemplate x:Key="RectLayerView">
        <forms:RectLayerView forms:MangoBox="{Binding MangoBox}" />

ViewModel

Here is binded BaseLayerViewModel

    public abstract class BaseLayerViewModel<LayerModel> : MvxViewModel
    {
        protected T _layerModel;

        public MangoBox MangoBox
        {
            get => _layerModel?.MangoBox;
        }

        public T LayerModel
        {
            get => _layerModel;
            set => SetProperty(ref _layerModel, value, () =>
            {
                _layerModel.MangoBox.PropertyChanged += (sender, e) =>
                {
                    RaisePropertyChanged(nameof(MangoBox));
                };
                RaisePropertyChanged(nameof(MangoBox));
            });
        }
    }

Model

LayerModel is used when BaeLayerViewModel created.

    public class LayerModel : MvxNotifyPropertyChanged
    {
        private MangoBox _mangoBox;
        public MangoBox MangoBox
        {
            get => _mangoBox;
            set => SetProperty(ref _mangoBox, value, () =>
            {
                BindBoxEventHandler();
            });
        }

        public LayerModel(MangoBox box)
        {
            _mangoBox = box;
            BindBoxEventHandler();
        }

        private void BindBoxEventHandler()
        {
            _mangoBox.XChanged += OnBoxPropertyChanged;
        }

        private void OnBoxPropertyChanged(object sender, MangoUnitChangedArgs e)
        {
            RaisePropertyChanged(nameof(MangoBox));
        }
    }

MangoBox

    public class MangoBox : MvxNotifyPropertyChanged
    {
        private readonly MangoPoint _point;
        private readonly MangoSize _size;

        public float RatioX
        {
            get => _point.RatioX;
            set => _point.RatioX = value;
        }

        public MangoBox(Standard2D standard, float x, float y, float width, float height)
        {
            _point = new MangoPoint(standard, x, y);
            _point.XChanged += OnXChanged;

        }

        public event EventHandler<MangoUnitChangedArgs> XChanged;

        private void OnXChanged(object sender, MangoUnitChangedArgs e)
        {
            XChanged?.Invoke(this, e);
            RaisePropertyChanged(nameof(RatioX));
            RaisePropertyChanged(nameof(ValueX));
        }

    }

Can I select the words and copy it?


CollectionView doesn't scroll when inside a Stacklayout inside a Grid inside another CollectionView

$
0
0

I'm not very surprised that this doesn't work. But perhaps I am missing something. As you can see, the last record is cut off by the edge of the Post and pulling it around only scrolls the parent CollectionView, not the CollectionView inside the Grid.

Page:

<ContentPage.Content>
<RefreshView>
<StackLayout>
<CollectionView ItemsSource="{Binding Posts}"> 
<CollectionView.ItemTemplate>
<DataTemplate><social:PostView /></DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</StackLayout>
</RefreshView>
</ContentPage.Content>

Post:

<ContentView.Content>
        <Frame>
            <StackLayout>
                <Grid>
                    <StackLayout>
                        <CollectionView ItemsSource="{Binding Suppliers}"> 
                            <CollectionView.ItemTemplate>
                                <DataTemplate>
                                    <datatemplates:SupplierSummaryTemplate /> 
                                </DataTemplate>
                            </CollectionView.ItemTemplate>
                        </CollectionView>
                    </StackLayout>
                </Grid>
            </StackLayout>
        </Frame>
    </ContentView.Content>

Code was working, then I renamed something--now Foundation.MonoTouchException

$
0
0
Objective-C exception thrown. Name: NSInternalINconsistencyExceptionReason: Application windows are expected to have a root view controller at the end of application launch.



This code was working perfectly until I renamed one of my files. What does this mean, and how can I fix it?

Is there any way to show a in app notification banner

$
0
0

I would like to show a small notification like this:

The Alertify plugin does it for javascript
alertifyjs.com/notifier/position.html
Maybe we could make a github repository to add this functionality

Is TapGestureRecognizer obsolete?

$
0
0

Hello, after updating to the latest version of Xamarin the TapGestureRecognizer all of a sudden stopped working.

Is there something wrong that I need to update with my code? https://pastebin.com/iT9GVDxi

Pagination in Listview

$
0
0

Hi all, I have nearly 1000 records in my ListView I need to show 100 records in each page. Can any one please help me on how to add Pagination in ListView. Any sample code or proper link on how to implemented will be very helpful!!

Thank you.

Viewing all 79144 articles
Browse latest View live


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