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

Triggering binding in other binding

$
0
0

Hi guys , I have a picker and button .I want to set button visibilty after picker selected. Seems like OnSelectedChanged action of picker can not be bind to a command . i have already binding for SelectedItem property so i thought i can use this for make button visible. It is working but there is a problem : Button visibilty doesnt changing after picker first selection time. After 1. selection if i select other thing on picker it is changing.

This is my code :
// MVVM part

public bool IsLevelSelected {
        get { return _isLevelSelected; }
        set
        {
            _isLevelSelected = value;
            OnPropertyChanged(nameof(IsLevelSelected));
        }

             }
    public string SelectedLevel
    {
        get
        {
            return _selectedLevel;
        }
        set
        {
            IsLevelSelected = true;
            _selectedLevel = value;
            OnPropertyChanged(nameof(SelectedLevel));

        }
    }

//XAML

<Picker x:Name="picker" Title="Seviye seçiniz" FontAttributes="Bold" FontSize="Large" Margin="0,50,0,0"
SelectedItem="{Binding SelectedLevel}" HorizontalOptions=" >
<Button Text="{Binding SelectedLevel,StringFormat='{0}. Leveli Başlat'}" d:Text="1.ci Leveli Başlat"
Command="{Binding StartGame}"
HeightRequest="100" Margin="20,40,20,20"
BorderWidth="5" BackgroundColor="DarkKhaki"
IsVisible="{Binding IsLevelSelected}"
CornerRadius="25" CommandParameter="{Binding SelectedLevel}"


How to download a file from sql locally in device to open in webview

$
0
0

HI,

How can I download a file from SQL database locally in mobile device to open in webview in the app.
Below is the code i am using .

Stream respStream = new MemoryStream(_lstCertificate[0].ScannedCertificate);
byte[] buffer = _lstCertificate[0].ScannedCertificate;
respStream.Read(buffer, 0, buffer.Length);
var dir = Config.PathApp;
var fileName = "foo.pdf";
string localPath = System.IO.Path.Combine(dir, fileName);
File.WriteAllBytes(localPath, buffer);
webView1.Source = localPath;// System.IO.Path.Combine(dir, fileName); //"";

Bluetooth Text Transfer in Xamarin.Forms

$
0
0

Hi all

I'm trying to create an App which should do the following:

  • Connect to a Host (Desktop PC) over Bluetooth
  • Send a Scanned QR-Code as Text or Bytes to the Host via Bluetooth

However i have no idea how to do that, couldnt find anything relevant on the internet. Does somebody have an idea how to achieve that?

Thank you
Giusi

How to solve this deployment error?

$
0
0

Hello, I've been working on this app no problem, but i noticed that if i clone it fresh to a different folder it builds without errors but it won't deploy to my device due to this exception:

Unhandled Exception:

System.TypeLoadException: Could not resolve type with token 01000018 from typeref (expected class 'ResourceLoadingQuery' in assembly '')

Now, fortunately I still have the local working copy that works, but a colleague that needs to clone it is not able to run it.
Google didn't really give me anything...
How can I solve this?

Thanks!

How do I move data files from one app to another

$
0
0

I have two apps where my "old" app are going to phase out and soon it will close down. My problem is that I have some historic data files placed where the app is installed and these data I need to move to my"new" app.

I guess that one solution is to first move all the data from the old app to an external location on the device and then - when starting up the new app - to move these files into the new app location. Problem is that it feels a bit clumsy that way. It would be nice if it's possible to just copy the data file directly from the old app to the new app some how e.g. when I start up the new app. Will that be possible .. otherwise what is the best way to handle this?

I need this for both Android and iOS :-)

Best Regards
Per

How to make the user to get sqlite db when he installs my app?

$
0
0

Hi,

I have a Xamarin.Forms application which uses SQLite DB.
The SQLite DB is on my device (Android), and the App uses it for read/write operations.

Now, if I upload the app to the market, I would like the user to get an empty SQLite db in his device.
How can I cause my app to install an Empty db in the user's phone, while he installs the app?

Thank you,
Eliran

Extending an Entry without custom renderer?

$
0
0

Hello,

I'm trying to create an extended Entry control (for example ValidationEntry) which lets me set the text color to red, or clear the text, if there is an error when submitting a form.

Can this be done cross platform without creating a custom renderer (since I'm just modifying standard properties of the Entry)? I've tried creating an extended Entry class with the following code inside:

    public static readonly BindableProperty ErrorProperty =
        BindableProperty.Create("Error", typeof(string), typeof(ValidationEntry), "");

    public string Error
    {
        get { return (string)GetValue(ErrorProperty); }
        set {
            Debug.WriteLine("ValidationEntry setting Error");
            SetValue(ErrorProperty, value);
            Text = "Testing";
        }
    }

I used TwoWay binding, and try to set the Error property from my viewmodel, yet it doesn't seem to show my debug output or affect the text. What's the proper way to do this?

How do l ressolve System.Net.WebException Error .The Internet connection appears to be offline


Metadata file could not be found

$
0
0

I was trying to solve x:Name problem (The name "blablabla" Does not exist in current context ) . I cleaned up and rebuild the solition but it didnt work. Then i manually clean obj and bin files it didnt work also and i have got new errors now. How can i deal with :

Page navigation from right to left

$
0
0

Hi, in my application i am using PushAsyncModel and PopAsyncModel for page navigation but page animation is displaying from bottom top and top to bottom respectively. Is there any other option to animate page from right to left or left to right?

Xamarin forms- Dynamically created webview not firing events

$
0
0

I am trying to automate a website data extraction by dynamically creating a webview and loading the source url. I want the page and webview to be NOT to be displayed to the user. Unfortunately the events seems not working. Any help appreciated

Here is what I am trying to do:

ContentPage cp = new ContentPage();
    cp.Title = "My Page";
    StackLayout sl = new StackLayout();
    var webView = new WebView();

    sl.Children.Add(webView);
    cp.Content = sl;

    webView.Navigating += WebView_Navigating;
    webView.Navigated += WebView_Navigated;

    webView.Source = "https://www.google.com/";//just a sample i tried multiple urls including http


private async void WebView_Navigating(object sender, WebNavigatingEventArgs e)
{
    //event not firing!
}

private async void WebView_Navigated(object sender, WebNavigatedEventArgs e)
{
    //event not firing!
}

Using the Minimum Width for CollectionView

$
0
0

I have a CollectionView which I want to use the minimum necessary width. The containing Grid has the following ColumnDefinitions:
<Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/><ColumnDefinition Width="*"/></Grid.ColumnDefinitions>
And the code for the CollectionView is as follows:

<d:CollectionView.ItemsSource>

1
2
3
4
5
6
7
8
9
10
11
12

</d:CollectionView.ItemsSource>
<CollectionView.ItemTemplate>

Does Xamarin.Forms have a replacement for UWP's RoutedEventArgs?

$
0
0

I am working on converting my apps from UWP to Xamarin.Forms. A large number of my event handlers' second parameter was of type RoutedEventArgs (or a descendant of it). I often used the Handled property of this to control which controls' events were triggered. I am still very new to Xamarin.Forms, but it seems like it uses EventArgs instead (in the GestureRecognizers), which does not include this property. Is there anything I can do to gain functionality similar to that provided by RoutedEventArgs in Xamarin.Forms? Thanks.

Firebase-How to log exceptions in xamarin.iOS

$
0
0

Hello,

I am implementing Firebase Crashlytics in xamarin forms.I want to log exceptions occurred in try/catch block to firebase.
I am using below line of code to track exception in xamarin android which are reflected as Non-fatal error on firebase portal (Which is achieved).
Android native code-
public void TrackException(Exception exception)
{
Crashlytics.Crashlytics.LogException(Java.Lang.Throwable.FromException(exception));
}

I am using dependency service to call above code in xamarin forms PCL project.
try
{
}
catch(Exception ex)
{
DependencyService.Get().TrackException(ex);
}

Similarly for xamarin.iOS I have method Crashlytics.SharedInstance.RecordError(objNSError);
How can I convert Exception to NSError object in xamarin?

Thanks,
Payal

Datepicker with a default value of null

$
0
0

Hi everyone

I do not want to make the date of birth field compulsory on the user registration page of my application. If the user does not want to enter the date of birth, the datepicker must be null.

When I researched how to do this, I found that the article in the forum was recommended ;

But that's not exactly the code I want.

I'm waiting for your help with this. How can I do that ?

Thanks in advance


Consumo API REST

$
0
0

Hello friends, could you help me how I can consume an article according to the ID and have consumed the categories but I cannot make the ListView navigate directly to the article of that category

HorizontalTextAlignment not working

$
0
0

i updated xamarin forms to the latest version yesterday (4.3.0.947036) ,and now for some reason text alignment for Entry control is not working on android, but works fine for IOS.
anybody got a solution for this?

Getting error "Could not load the framework 'libsswiftCore.dylib'" not found.

$
0
0

I just updated Xcode to 11.2.1 and Xamarin forms to 4.3 latest. When I try to debug I get this error. error HE0003: Could not load the framework 'libswiftCore.dylib' (path: /Applications/Xcode.app/Contents/Frameworks/libswiftCore.dylib): not found.

How to set shell bottom tab title fontsize without animation and top tab text lowercase?

UWP Listview binding data template binding to page view model instead of ItemsSource class

$
0
0

I have a Xamarin forms project with Android and UWP targets. The Android version has been fully tested and released and works great. I'm using the latest versions of Xamarin (4.2.0.848062). I'm currently working on the UWP version and have run into an issue in the shared project. As stated, everything works fine on Android, but not in UWP. Here's the scenario and the pertinent information:

I have a viewmodel that derives from a class that has the following:
public ICommand IncrementCommand { get { // blah, blah, blah } }

The viewModel is bound to my page with the following xaml (only showing pertinent code).
Test

 <ListView ItemTapped="OnListViewTapped" 
        ItemsSource="{Binding CarriageMotorCfg}" 
        HasUnevenRows="true">

        <ListView.ItemTemplate>
          <DataTemplate>
            <ViewCell>
                            <StackLayout Orientation="Vertical">

                                    <local:ImageButton 
                        Source="{local:ImageResource EclipseDiag.images.plus.png}" Command="{Binding IncrementCommand}" CommandParameter="MotorCountString" Aspect="AspectFit" Margin="0" />

                                    <Entry Text="{Binding MotorCountString, Mode=TwoWay}" 
                            Placeholder="xxxx"
                            Keyboard="Numeric" 
                            VerticalOptions="Center"/>
...

CarriageMotorCfg is an ObservableCollection of a class that happens to contain the following (note, it is the same name as in the viewmodel above:
public ICommand IncrementCommand { get { // blah, blah, blah } }

When I try to load the page while running on UWP, the Binding of 'IncrementCommand' 'within the listview data template ends up getting mapped to the page's ViewModel instead of the class of CarriageMotorCfg. All of the other bindings in the template get mapped to the 'CarriageMotorCfg' class as desired. It is like the Xamarin UWP implementation is first checking the ViewModel for a match of 'IncrementCommand' before checking the class of 'CarriageMotorCfg'. If I change the name of the command within the 'CarriageMotorCfg' class to 'IncrementCommand2' and also change the XAML, then everything works as expected.

As stated above, this code works fine on Android so it seems to be this is a bug in Xamarin UWP. Any thoughts on fixing this without having to rename the commands?

Viewing all 91519 articles
Browse latest View live


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