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

Multiline in listview

$
0
0

Hello,

Found something to store in Firebase database online , that works .

But when i make the text to long it is being cut of.

See bottom of picture , the text is not important but not all of it.

Is there a way to make a multiline listview or do i use something else to show the data ?

The code i use

`<ContentPage.Content>


                <Image Margin="0,0,0,10" HeightRequest="50" Source="Firebase" ></Image>
                <Label Margin="0,0,0,10" Text="Reactie's" FontAttributes="Bold" FontSize="Large" TextColor="Gray" HorizontalTextAlignment="Center" ></Label>
                <Entry x:Name="txtId" Placeholder="Plaats Uw reactie en naam , dan toevoegen " IsReadOnly="true" IsVisible="True">

                </Entry>
                <Entry x:Name="txtName" Placeholder="Reactie"></Entry>
                <Entry x:Name="txtWie" Placeholder="Uw naam"></Entry>
                <StackLayout  HorizontalOptions="CenterAndExpand" Orientation="Horizontal">
                    <Button x:Name="btnAdd" WidthRequest="200" Text="Toevoegen" Clicked="BtnAdd_Clicked"/>

                </StackLayout>


                <ListView x:Name="lstPersons" HasUnevenRows="true">

                    <ListView.ItemTemplate>
                        <DataTemplate>
                            <TextCell Text="{Binding Name}"></TextCell>
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
            </StackLayout>
        </StackLayout>
    </StackLayout>
</ContentPage.Content>

`

`namespace Ouderijn
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class Data : ContentPage
{
FirebaseHelper firebaseHelper = new FirebaseHelper();
public Data()
{
InitializeComponent();
lstPersons.HasUnevenRows = true;
}
protected async override void OnAppearing()
{

        base.OnAppearing();
        var allPersons = await firebaseHelper.GetAllPersons();
        lstPersons.ItemsSource = allPersons;
    }

    private async void BtnAdd_Clicked(object sender, EventArgs e)
    {
        //await firebaseHelper.AddPerson(Convert.ToInt32(txtId.Text), txtName.Text , txtWie.Text);
        txtName.Text = txtName.Text + " " + txtWie.Text;
        await firebaseHelper.AddPerson(Convert.ToInt32(txtId.Text), txtName.Text, txtWie.Text);
        txtId.Text = string.Empty;
        txtName.Text = string.Empty;
        txtWie.Text = string.Empty;
        await DisplayAlert("Bericht toegevoegd.", "", "OK");
        var allPersons = await firebaseHelper.GetAllPersons();
        lstPersons.ItemsSource = allPersons;
        await Navigation.PushAsync(new MainPage());
    }



}

}
`


CollectionView inside ScrollView

$
0
0

I'm trying to add 2 CollectionView in the same form using ScrollView.

The ScrollView is scrolling as expected but each CollectionView is also scrolling (a "slight" scrolling for about 20px) separately.

I can't figure out why.

What I need is to disable scrolling on both collectionview, but keep it for the whole form.

Thanks!

Here is my code:


<?xml version="1.0" encoding="utf-8" ?>

    <ScrollView>
    <StackLayout>
        <CollectionView VerticalOptions="Center" HorizontalOptions="Center"
                ItemsSource="{x:Static data:ServicesData.ServiceItems}"
                SelectionMode="Single"
                SelectionChanged="OnCollectionViewSelectionChanged">
            <CollectionView.ItemsLayout>
                <GridItemsLayout Orientation="Vertical" Span="3"/>
            </CollectionView.ItemsLayout>
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <StackLayout>
                        <Frame x:Name="FrameExtContainer" Padding="0.5" HasShadow="False" HorizontalOptions="FillAndExpand" CornerRadius="0" OutlineColor="LightGray" BackgroundColor="LightGray" >
                            <Frame x:Name="FrameIntContainer" HasShadow="False" HorizontalOptions="FillAndExpand" CornerRadius="0" Padding="0">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <StackLayout Grid.Row="0" Grid.Column="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Margin="5,15,5,10">
                                        <Image Source="{Binding ImageUrl}" Aspect="AspectFit" HeightRequest="50" WidthRequest="50" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"/>
                                    </StackLayout>
                                    <StackLayout Grid.Row="1" Grid.Column="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Margin="5,10,5,5">
                                        <Label Text="{Binding Name}" FontSize="12" TextColor="Black" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"/>
                                    </StackLayout>
                                </Grid>
                            </Frame>
                        </Frame>
                    </StackLayout>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>

        <CollectionView VerticalOptions="Center" HorizontalOptions="Center"
                ItemsSource="{x:Static data:ServicesData.ServiceItems}"
                SelectionMode="Single"
                SelectionChanged="OnCollectionViewSelectionChanged">
            <CollectionView.ItemsLayout>
                <GridItemsLayout Orientation="Vertical" Span="3"/>
            </CollectionView.ItemsLayout>
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <StackLayout>
                        <Frame x:Name="FrameExtContainer1" Padding="0.5" HasShadow="False" HorizontalOptions="FillAndExpand" CornerRadius="0" OutlineColor="LightGray" BackgroundColor="LightGray" >
                            <Frame x:Name="FrameIntContainer1" HasShadow="False" HorizontalOptions="FillAndExpand" CornerRadius="0" Padding="0">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="*" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>
                                    <StackLayout Grid.Row="0" Grid.Column="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Margin="5,15,5,10">
                                        <Image Source="{Binding ImageUrl}" Aspect="AspectFit" HeightRequest="50" WidthRequest="50" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"/>
                                    </StackLayout>
                                    <StackLayout Grid.Row="1" Grid.Column="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Margin="5,10,5,5">
                                        <Label Text="{Binding Name}" FontSize="12" TextColor="Black" HorizontalOptions="CenterAndExpand" VerticalOptions="CenterAndExpand"/>
                                    </StackLayout>
                                </Grid>
                            </Frame>
                        </Frame>
                    </StackLayout>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>


    </StackLayout>
    </ScrollView>


Xamarin forms iOS (GoogleSignIn or Facebook or FirebaseNotification) doesn't build on generic device

$
0
0

I am trying to distribute my iOS app, in the simulator everything works just perfect, when I use Release > Generic Device, it shows me mtouch linking error, When I remove the packages it works good, and compiles normally, my issues is with these three packages (Xamarin.IOS.Facebook, Xamarin.GoogleSignin, Birdie.Plugin.FirebaseNotification), I removed Facebook and Firebase and left only GoogleSignIn, removed the GoogleSignIn code too (am not using GoogleSignIn in the code yet) but I am getting this error, tried microsoft AppCenter iOS distribution build with no luck too the same log appears, Also on Appcenter, the simulator builds normally.
I am using VS for Mac :

Xamarin.Mac
Version: 5.16.1.24 (Visual Studio Community)
Hash: 08809f5b
Branch: d16-3
Build date: 2019-09-06 08:42:41-0400

Xamarin.iOS
Version: 12.16.1.24 (Visual Studio Community)
Hash: 08809f5b
Branch: d16-3
Build date: 2019-09-06 08:42:42-0400

The package Xamarin.Google.iOS.SignIn version is : 4.4.0

(_CompileToNative target) -> 
  MTOUCH : warning MT0109: The assembly 'System.Net.Http.dll' was loaded from a different path than the provided path (provided path: /Users/vsts/.nuget/packages/system.net.http/4.3.4/runtimes/win/lib/netstandard1.3/System.Net.Http.dll, actual path: /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/lib/mono/Xamarin.iOS/System.Net.Http.dll). [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : warning MT0109: The assembly 'System.Net.Http.dll' was loaded from a different path than the provided path (provided path: /Users/vsts/.nuget/packages/system.net.http/4.3.4/runtimes/win/lib/netstandard1.3/System.Net.Http.dll, actual path: /Library/Frameworks/Xamarin.iOS.framework/Versions/12.14.0.114/lib/mono/Xamarin.iOS/System.Net.Http.dll). [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : warning MT4174: Unable to locate the block to delegate conversion method for the method myApp.iOS.AppDelegate.WillPresentNotification's parameter #3. [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : warning MT4174: Unable to locate the block to delegate conversion method for the method myApp.iOS.AppDelegate.WillPresentNotification's parameter #3. [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : warning MT5215: References to 'System' might require additional -framework=XXX or -lXXX instructions to the native linker [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : warning MT5215: References to 'System' might require additional -framework=XXX or -lXXX instructions to the native linker [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : warning MT5215: References to 'System.Net.Security' might require additional -framework=XXX or -lXXX instructions to the native linker [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]


"/Users/vsts/agent/2.155.1/work/1/s/myApp.sln" (Rebuild target) (1) ->
"/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj" (Rebuild target) (3) ->
(_CompileToNative target) -> 
  clang : error : linker command failed with exit code 1 (use -v to see invocation) [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : error MT5210: Native linking failed, undefined symbol: _GTMSessionFetcherAssertValidSelector. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: GTMSessionFetcher. The symbol '_OBJC_CLASS_$_GTMSessionFetcher' could not be found in any of the libraries or frameworks linked with your application. [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : error MT5211: Native linking failed, undefined Objective-C class: GTMSessionFetcherService. The symbol '_OBJC_CLASS_$_GTMSessionFetcherService' could not be found in any of the libraries or frameworks linked with your application. [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : error MT5210: Native linking failed, undefined symbol: _kGTMSessionFetcherStatusDomain. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : error MT5201: Native linking failed. Please review the build log and the user flags provided to gcc: -ObjC -lsqlite3 [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]
  MTOUCH : error MT5202: Native linking failed. Please review the build log. [/Users/vsts/agent/2.155.1/work/1/s/myApp/myApp.iOS/myApp.iOS.csproj]

    122 Warning(s)
    7 Error(s)

panoramic shots

$
0
0

I want to take panoramic shots with my iPhone.
Do you have a example?

Got the following response from Xamarin: ITMS-90809: Deprecated API Usage

Why does SwipeGestures still not work

$
0
0

I am a little frustrated trying to use Xamarin Forms. A lot of things still does not work, even if the errors have been reported years ago.

Example: SwipeGestures does not work in android projects. Why not?

Value cannot be null. almost impossible to get out of this one, unless you reenter the hole project from scratch.

CarouselView which should be the replacement for CarouselPage, does not work since the swipe threshold and/or sensibillity does not work.

Asymmetric data encryption

$
0
0

Hi All,

I am building a Xamarin Forms app for both iOS and Android. There I'm planing to use AppCenter.Crash for crash reporting.
With AppCenter.Crash we can send additional data so that developer may have more insight on the crash.

Since there may be some sensitive data to be sent(single string will composed), is it possible encrypt this?
I feel Public/Private key encryption would match this scenario. If we can ship public key with App then we can encrypt data where developer can access cypher in AppCenter and use the private key to decrypt.
Is this possible in xamarin? or do we have other alternative to address this?

Thanks

How can I create a TabbedPage from data brought from a web service without blocking the user interfa

$
0
0

I am trying to create a TabbedPage within a MasterDetailPage from data brought from a web service. The issue with this is that I am blocking the user interface because I have to wait for the task that JSON brings to then iterate it and create the corresponding ViewModels for each ContentPage of the TabbedPage.

My code is something like: Mi TabbePage:

<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MyProject.Views.MyTabbedPage"
             ItemSource={Binding Tabs}>
    <TabbedPage.ItemTemplate>
        <DataTemplate>
            <ContentPage Title={Binding Description}>
                ...
            </ContentPage>
        </DataTemplate>
    </TabbedPage.ItemTemplate>


My TabbedPageViewModel:

public TabbedPageViewModel()
        {
            var task = Task.Run(async () => { await LoadThings(); });
            Task.WaitAll(task);
            Tabs = new ObservableCollection<TabbedPageDetailViewModel>();
            foreach (var t in Things)
            {
                Tabs.Add(new TabbedPageDetailViewModel(t.IdCode, t.Description));
            }
        }


        private async Task LoadThings()
        {
            Things = new List<Thing>(await App.WebApiManager.GetCustomerThingsAsync(App.User.IdCustomer));
        }

My TabbedPageDetailViewModel:

public TabbedPageDetailViewModel(string idCode, string description)
        {
            IdCode = idCode;
            Description = description;
            Task task1 = Task.Run(async () => await LoadTask1(idCode));
            var task2 = Task.Run(async () => { await LoadTask2(idCode); });
            Task.WaitAll(task1, task2);
        }


        private async Task LoadTask1(string idCode)
        {
            //await code that brings API data to load controls
        }

        private async Task LoadTask(string idCode)
        {
            // await code that brings API data to load controls
        }

All this code blocks the user interface while the data is consumed from the API. How can I implement this in a correct synchronous way which allows my interface to remain reactive? PS: I can download my collection of Things in the login process of my app but I still get some delay when TabbedPageDetailViewModel is being instantiated.


Disallowed sharing of WebView data directory

$
0
0

Hi

After installing Android 9 on the devices, the app is crashing when using more that one webView. I have found code for a fix in Java, but it seems like the Xamarin Android.WebKit library doesn't have the method required, which is WebView.setDataDirectorySuffix.

Anyone have a workaround or solution for this?

System.NullReferenceException:'Object reference not set to an instance of an object.' How to resolve

$
0
0

I'm new to xamarin. forms I'm doing a sample project like a travel record I need to show a list count on the label text property
and I do the label text property is null

here my XAML code:

<?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:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="TravelRecordApp.ProfilePage">
    <ContentPage.Content>
        <StackLayout Margin=" 20,40,20,0">
            <Label x:Name=" postCountLabel" 
                   HorizontalOptions="Center"
                   TextColor="DodgerBlue"
                   FontAttributes="Bold"
                   Text="----------_---------"/>
            <Label Text=" posts"
                   HorizontalOptions="Center"
                   TextColor="LightGray"/>
            <ListView x:Name="categoriesListView">
                <ListView.ItemTemplate >
                    <DataTemplate>
                        <ViewCell >

                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

C#:

using Xamarin.Forms.Xaml;

namespace TravelRecordApp
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class ProfilePage : ContentPage
    {
        public ProfilePage()
        {
            InitializeComponent();
        }
        protected override void OnAppearing()
        {
            base.OnAppearing();

            using (SQLiteConnection conn = new SQLiteConnection(App.DatabaseLocation))
            {
                var   postTable = conn.Table<Post>().ToList();

                postCountLabel.Text = postTable.Count.ToString();


            }

        }
    }
}

List from DataTemplateSelector for survey

$
0
0

Hello Developers,

I am using DataTemplateSelector for survey. I have 4 or 5 question each page and each page have two button “Previous and Next”.
I am able to storing more than one question in page First but unable to create more then one page.
Below I written my code please see and help me I am surfing in this issue from a week.

This is my DataTemplateSelector Class

    public class QuestionDataTemplateSelector : DataTemplateSelector
    {
        public DataTemplate RadioButtonTem { get; set; }
        public DataTemplate FreeTextTem{ get; set; }
        public DataTemplate CheckBoxTem { get; set; }

        protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
        {
        DataTemplate resultTemp = new DataTemplate();

        var questionModel = item as QuestionModel;

        if (questionModel != null)
        {
            switch (questionModel.QuestionType)
            {
                case "RadioButton":
                    resultTemp = RadioButtonTem;
                    break;
                case "FreeText":
                    resultTemp = FreeTextTem;
                    break;
                case "CheckBox":
                    resultTemp = CheckBoxTem;
                    break;
            }
        }
                return resultTemp;
        }
    }

These are my model classes

public class QuestionModel 
{
    public QuestionModel()
    {
        RadioButtonList = new ObservableCollection<RadioButtonModel>();
        CheckBoxList = new ObservableCollection<CheckBoxModel>();
    }

    public ObservableCollection<RadioButtonModel> RadioButtonList { get; set; }
    public ObservableCollection<CheckBoxModel> CheckBoxList { get; set; }

    public int Id { get; set; }
    public string Question { get; set; }
    public string QuestionType { get; set; }
}

public class RadioButtonModel 
{
    public int Id { get; set; }
    public string value { get; set; }
    public bool IsChecked { get; set; }
}

public class CheckBoxModel 
{
    public int Id { get; set; }
    public string value { get; set; }
    public bool IsChecked { get; set; }
}

This is my ViewModel Class

public class QuestionViewModel : INotifyPropertyChanged
{
    public QuestionViewModel()
    {
        RadioButtonList = new ObservableCollection<RadioButtonModel>
        {
            new RadioButtonModel
            {
                Id = 1,
                IsChecked = false,
                value = "Yes",
            },
            new RadioButtonModel
            {
                Id = 2,
                IsChecked = false,
                value = "No",
            }
        };

        CheckBoxList = new ObservableCollection<CheckBoxModel>
        {
            new CheckBoxModel
            {
                Id = 1,
                IsChecked = false,
                value = "Yes"
            },
            new CheckBoxModel
            {
                Id = 2,
                IsChecked = false,
                value = "No"
            },
            new CheckBoxModel
            {
                Id = 3,
                IsChecked = false,
                value = "Na"
            },
        };

        QuestionList = new ObservableCollection<QuestionModel>
        {
            new QuestionModel
            {
                Id =1,
                RadioButtonList = RadioButtonList,
                CheckBoxList = CheckBoxList,
                Question = "Is this Radio button",
                QuestionType = "RadioButton",
            },
            new QuestionModel
            {
                Id =2,
                RadioButtonList = RadioButtonList,
                CheckBoxList = CheckBoxList,
                Question = "Is this Free Text",
                QuestionType = "FreeText",
            },
            new QuestionModel
            {
                Id =3,
                RadioButtonList = RadioButtonList,
                CheckBoxList =  CheckBoxList,
                Question = "Is this Check box",
                QuestionType = "CheckBox",
            },
        };
    }

    private ObservableCollection<QuestionModel> _questionList;
    public ObservableCollection<QuestionModel> QuestionList
    {
        get { return _questionList; }
        set
        {
            _questionList = value;
            OnPropertyChanged("QuestionList");
        }
    }

    private ObservableCollection<CheckBoxModel> _checkBoxList;
    public ObservableCollection<CheckBoxModel> CheckBoxList
    {
        get { return _checkBoxList; }
        set
        {
            _checkBoxList = value;
            OnPropertyChanged("CheckBoxList");
        }
    }

    private ObservableCollection<RadioButtonModel> _radioButtonList;
    public ObservableCollection<RadioButtonModel> RadioButtonList
    {
        get { return _radioButtonList; }
        set
        {
            _radioButtonList = value;
            OnPropertyChanged("RadioButtonList");
        }
    }   

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged(string propertyName)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
    }
}

This is my design(Xaml) code

<ContentPage.Resources>
    <ResourceDictionary>
        <DataTemplate x:Key="TemplateFreeText">
            <ViewCell>
                <Grid RowSpacing="15">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Label Grid.Row="0" Text="{Binding Question}" TextColor="Black" FontAttributes="Bold" FontSize="18"/>
                    <Editor Grid.Row="1" Placeholder="Enter..." />
                </Grid>
            </ViewCell>
        </DataTemplate>

        <DataTemplate x:Key="TempRadioButton">
            <ViewCell>
                <Grid RowSpacing="15" >
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Label Grid.Row="0" Text="{Binding Question}" TextColor="Black" FontAttributes="Bold" FontSize="18"/>
                    <Grid Grid.Row="1" Padding="20,0"  VerticalOptions="Center">
                        <rb:BindableRadioGroup x:Name="RadiouGroup" SelectionMode="Single" ItemsSource="{Binding RadioButtonList, Mode=TwoWay}" 
                            <grial:Repeater.ItemTemplate>
                                <DataTemplate>
                                    <StackLayout Orientation="Horizontal" Spacing="15" >
                                        <grial:Checkbox IsChecked="{Binding IsChecked, Mode=TwoWay}">
                                            <Label Text="{ Binding value}" Margin="0,0" />
                                        </grial:Checkbox>
                                    </StackLayout>
                                </DataTemplate>
                            </grial:Repeater.ItemTemplate>
                            <grial:Repeater.SelectedItemTemplate>
                                <DataTemplate>
                                    <StackLayout Orientation="Horizontal">
                                        <grial:Checkbox IsChecked="{Binding IsChecked,Mode=TwoWay}" >
                                            <Label Text="{ Binding value}" Margin="0,0" />
                                        </grial:Checkbox>
                                    </StackLayout>
                                </DataTemplate>
                            </grial:Repeater.SelectedItemTemplate>
                        </rb:BindableRadioGroup>
                    </Grid>
                </Grid>
            </ViewCell>
        </DataTemplate>

        <DataTemplate x:Key="TempCheckBox">
            <ViewCell>
                <Grid RowSpacing="15">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50"/>
                        <RowDefinition Height="*"/>
                    </Grid.RowDefinitions>
                    <Label Grid.Row="0" Text="{Binding Question}" TextColor="Black" FontAttributes="Bold" FontSize="18"/>
                    <Grid Grid.Row="1" Padding="20,0"  VerticalOptions="Center">
                        <rb:BindableRadioGroup x:Name="RadiouGroup" SelectionMode="Single" ItemsSource="{Binding CheckBoxList, Mode=TwoWay}">
                            <grial:Repeater.ItemTemplate>
                                <DataTemplate>
                                    <StackLayout>
                                        <grial:Checkbox IsChecked="{Binding IsChecked, Mode=TwoWay}">
                                            <Label Text="{ Binding value}"/>
                                        </grial:Checkbox>
                                    </StackLayout>
                                </DataTemplate>
                            </grial:Repeater.ItemTemplate>
                            <grial:Repeater.SelectedItemTemplate>
                                <DataTemplate>
                                    <StackLayout Orientation="Horizontal" >
                                        <grial:Checkbox IsChecked="{Binding IsChecked,Mode=TwoWay}"  >
                                            <Label Text="{ Binding value}" Margin="8,0" />
                                        </grial:Checkbox>
                                    </StackLayout>
                                </DataTemplate>
                            </grial:Repeater.SelectedItemTemplate>
                        </rb:BindableRadioGroup>
                    </Grid>
                </Grid>
            </ViewCell>
        </DataTemplate>

        <vc:QuestionDataTemplateSelector x:Key="QuestionDataTemplateSel"
                                         RadioButtonTem="{StaticResource TempRadioButton}"
                                         FreeTextTem="{StaticResource TemplateFreeText}"
                                         CheckBoxTem="{StaticResource TempCheckBox}"/>
        </ResourceDictionary>
    </ContentPage.Resources>
    <ContentPage.Content>
        <StackLayout x:Name="stk">
            <ListView x:Name="list"
                      ItemsSource="{Binding QuestionList}"
                      HasUnevenRows="True"
                      ItemTemplate="{StaticResource QuestionDataTemplateSel}"
                      SeparatorVisibility="None"/>
        </StackLayout>
</ContentPage.Content>

I want to more than one question each page and more than one page.

Is there any module in xamarin android and ios for loading?

$
0
0

Is there any module in xamarin android and ios for loading except userdialog?

Invalid file path obj\Debug\90\res\properties\assemblyinfo.cs'.

$
0
0

I get this error while building the project--

"invalid file path 'obj\Debug\90\res\properties\assemblyinfo.cs'.

I have deleted the bin,obj folders and rebuild it. Error still appears

PanGesture and TapGesture together in a ListView Cell

$
0
0

Hello everyone,

I have a ListView where i'm putting a Pangesture to do swipe on each cells. My issue is that I have an area (Grid) on my cell where I need to put a TapGesture but it is not working, TapGesture method is never called. Why is it get cancelled ? I have also a button which is work perfectly with PanGesture. Why TapGesture and Button doesn't have the same behaviour ?

Thanks !

Face recognition login

$
0
0

I am creating an android app which should allow face recognition for login. How do I do that? Which packages shall I use? Any references for the same would be helpful


How to prevent Editor to go behind the keyboard in Xamarin.Forms?

$
0
0

Hi,

I have a Chat app. Currently, there is an Entry control for add chat text. Now I want to provide multiline Entry, same like Whatsapp.

  • If user type more than one line, it should automatic wrap the text to next line.
  • If user click on Nextline button in mobile keyboard, it should go to next line.
  • Height of Entry should be automatically increase upto 3 line and it should also decrease if user remove text.

To do that I have tried to replace Entry with Editor and implement following functionality.

1- Put an Editor in place of Entry.
2- Implement a functionality that keep keyboard open until user click on Message list screen or back button.

Now I am trying to implement auto height functioanlity but when user try to type, Editor goes behind the keyboard. Can anybody please suggest me how to keep Editor open and auto size?

Current code:

XAML:

Editor

public class ChatEditorWithPlaceholder : Editor
{
    public ChatEditorWithPlaceholder()
    {
        this.TextChanged += (sender, e) => { this.InvalidateMeasure(); };
    }
}

Editor Renderer:

public class ChatEditorRenderer : EditorRenderer
{
    protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
    {
        base.OnElementPropertyChanged(sender, e);
    }
}

protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
{
    base.OnElementChanged(e);
    if(Control != null) {
        Control.ScrollEnabled = false;
    }
    var element = this.Element as ChatEditorWithPlaceholder;

    Control.InputAccessoryView = null;
    Control.ShouldEndEditing += DisableHidingKeyboard;

    MessagingCenter.Subscribe<ConversationPage>(this, "FocusKeyboardStatus", (sender) =>
    {

        if (Control != null)
        {
            Control.ShouldEndEditing += EnableHidingKeyboard;
        }

        MessagingCenter.Unsubscribe<ConversationPage>(this, "FocusKeyboardStatus");
    });
}
private bool DisableHidingKeyboard(UITextView textView)
{
    return false;
}

private bool EnableHidingKeyboard(UITextView textView)
{
    return true;
}

Screenshots:

Proguard problem on java.lang.ClassNotFoundException for AlarmBootBroadcastReceiver

$
0
0

I have implemented a AlarmBootBroadcastReceiver in order to keep notifications when user reboots the device.

Manifest and Class looks like as below

    <receiver android:name="com.mycompany.myapp.myNotifications.AlarmBootBroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
            </intent-filter>
        </receiver>

namespace myNotifications
{
    [Fitness.Shared.Runtime.Preserve(AllMembers = true)]
    [BroadcastReceiver(Enabled = true, Label = "Boot Notifications Broadcast Receiver")]
    public class AlarmBootBroadcastReceiver : BroadcastReceiver
    {}
}

I get exception as

dalvik.system.BaseDexClassLoader.findClass
BaseDexClassLoader.java, line 134
java.lang.ClassNotFoundException: Didn't find class 
"com.mycompany.myapp.myNotifications.AlarmBootBroadcastReceiver" on path: DexPathList[[zip file
 "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/com.mycompany.myapp-QZQO_TGn1IR66ieLaOR24A==/base.apk"],
 nativeLibraryDirectories=[/data/app/com.mycompany.myapp-QZQO_TGn1IR66ieLaOR24A==/lib/arm, /data/app/com.mycompany.myapp-
QZQO_TGn1IR66ieLaOR24A==/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]

I assume that Proguard removes the class as it doesnt have any reference call. I have extended my proguard adding lines below

-keep class com.mycompany.myapp.myNotifications.AlarmBootBroadcastReceiver.** { *; }
-keepclassmembers class com.mycompany.myapp.myNotifications.AlarmBootBroadcastReceiver.** { *; }

But i am still getting the exception.
is that something to do with namespaces? normally in native java implementation you would write with app name+namespace+class name. do we do the same in xamarin? because my class is in shared class with simply having "myNotifications" namespace? Or probably i am missing something in Proguard keep class lines?

Separate Key Pair using PCLCrypto (Windows.Security.Cryptography)

$
0
0

I want to separate the key pair using PCLCrypto, but 'CryptographicEngine.Encrypt' and 'CryptographicEngine.Decrypt' expects a 'ICryptographicKey' that the description says : "Represents a symmetric key or an asymmetric key pair", that means it cannot be a just the public or just the private asymetric key ?
Because I need the server to have one and the user the other, how do I separate them into a 'ICryptographicKey' type?

That's what I have working :

using PCLCrypto; using static PCLCrypto.WinRTCrypto; //... ICryptographicKey keyPair = AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithm.RsaPkcs1).CreateKeyPair(512); var encrypted = CryptographicEngine.Encrypt(keyPair, Encoding.UTF8.GetBytes("ANYTEXT")); var decrypted = CryptographicEngine.Decrypt(keyPair, encrypted); string = Encoding.UTF8.GetString(decrypted, 0, decrypted.Length);

FAILED to separate the private key like that, throws an Exception saying private key is missing :
byte[] byteKeyPubl = keyPair.ExportPublicKey(); ICryptographicKey keyPubl = AsymmetricKeyAlgorithmProvider.OpenAlgorithm(AsymmetricAlgorithm.RsaPkcs1).ImportPublicKey(byteKeyPubl); //then var decrypted = CryptographicEngine.Decrypt(keyPubl, encrypted);

Besides that i'd also need to separate the private key, that doesn't even have a function like '.ExportPublicKey()'.

:) thanks already

Automate Xamarin Android unit tests and integrate with Jenkins

$
0
0

I am struggling to achieve a very basic workflow. I am trying to automate the android and iOS unit tests to run daily on a specific device and report the results. We are using Jenkins internally for such automated jobs and hence would like use it to report the results from iOS and Android unit tests. To be clear I don't want to use Xamarin Test cloud or any other services based system. I want to keep it simple i.e trigger running unit tests on device and report results.

My the Android Unit Test project has it's own UI and allows you to run your Unit Tests. The results of the tests are written in a log file on the device. When I run the unit test project, an app is launched and I can choose to run everything ( i.e all tests) or choose some categories. For automated runs, I want to run everything.
I learnt that to achieve this I would need to add a Xamarin UI test project. I created a UI Test project in same solution as unit test project and added reference of Android unit test project to it. UI Test project was updated to point to the apk of the unit test project and I added a app.Tap to tap on Run All button in the unit test project. So far so good. I choose to run the UI test from test explorer, it launches the apk ( actual unit tests app) and Run All is automatically tapped and tests start running.
The challenge I am facing is how to get the results off of the device and then report them on Jenkins.
I see there are many partial post around this topic but haven't found any comprehensive post that explains this end to end. I was wondering if anyone has taken this approach and can share their experiences and knowledge.

Update UI Elements when task is done

$
0
0

How do I update the corresponding UI elements when its task is done

My current code seems to be waiting for task1 to be completed first then will update task1 UI Elements and process to update task2 UI elements.

it seems that even if task2 has being completed, the code will still wait for task1 to be done before it will do task2 updating of task2 elements

Current Code
`var task1 = GetTask1DataAsync(filters);
var task2= GetTask2DataAsync(filters);
var task3= GetTask3DataAsync(filters);
var task4= GetTask4DataAsync(filters);
var task5 = GetTsk5DataAsync(filters);
await Task.WhenAll(task1, task2, task3, task4, task5);

... update all the elements

var task1Result = task1.Result
// updating task1 UI elements with task1 data

var task2Result = task2.Result
// updating task2 UI elements with task2 data

var task3Result = task3.Result
// updating task3 UI elements with task3 data
`

What i would like to achieve
`var task1 = GetTask1DataAsync(filters);
var task2= GetTask2DataAsync(filters);
var task3= GetTask3DataAsync(filters);
var task4= GetTask4DataAsync(filters);
var task5 = GetTsk5DataAsync(filters);

await Task.WhenAll(task1, task2, task3, task4, task5);

if(task1 is completed)
{
update UI elements with task1.Result data
}

if(task2 is completed)
{
update UI elements with task2.Result data
}
`

the various task1 - task5 should be done in parallel.

I want the UI elements to be updated based on which task has been completed.

Viewing all 77050 articles
Browse latest View live


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