We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Model binding on iOS

Thread ID:

Created:

Updated:

Platform:

Replies:

117528 Nov 4,2014 05:18 AM Apr 13,2015 09:02 AM Xamarin.Forms 13
loading
Tags: SfCircularGauge
Rune Jensen
Asked On November 4, 2014 05:18 AM

We are considering using syncfusion for graphs in our xamarin forms app. We created a very simple test app, where the value is changed to a random number every two seconds using model binding.

This works fine on Andriod, but iOS does not update the value on either the rangepointer or the needlepointer.  The method that creates the content page is pasted below. Note that the value on iOS does reflect the initial value of 50 but never changes. The text of the label however does change. Is this a bug or am I doing anything wrong?

public static Page GetMainPage ()
        {    
            var model = new model ();
            model.Value = 50;

            var pointer = new RangePointer {
                Color = Color.Green
            };

            var pointer2 = new NeedlePointer {
                Color = Color.Blue
            };

            pointer.BindingContext = model;
            pointer.SetBinding<model> (RangePointer.ValueProperty, m => m.Value);

            pointer2.BindingContext = model;
            pointer2.SetBinding<model> (NeedlePointer.ValueProperty, m => m.Value);

            Scale scale = new Scale {
                StartValue = 0,
                EndValue = 100,
                StartAngle = 180,
                SweepAngle = 180,
                RimThickness = 50,
                RimColor = Color.FromHex ("#FB0101"),
                ShowLabel = false,
                LabelColor = Color.White,
                Pointers = {
                    pointer,
                    pointer2
                }
            };

            var gauge = new SfCircularGauge {
                FrameBackgroundColor = Color.White,
                Headers = {
                    new Header {
                        Text = "Production",
                        ForegroundColor = Color.Black
                    }
                },
                FrameType = FrameTypes.None,
                VerticalOptions = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                Scales = {
                    scale
                }
            };

            var text = new Label ();
            text.BindingContext = model;
            text.SetBinding<model> (Label.TextProperty, m => m.Value);

            Task.Run(() => {
                var rand = new Random();
                while(true) {
                    Task.Delay(2000).Wait();

                    model.Value = (double)rand.Next(100);
                }
            });

            return new ContentPage {
                Content = new StackLayout {
                    Orientation = StackOrientation.Vertical,
                    Children = {
                        gauge,
                        text
                    }
                }
            };
        }
    }

Arun A [Syncfusion]
Replied On November 5, 2014 01:10 AM

Hi Rune Jensen,

Sorry for the inconvience caused.

We are able to see the reported behavior in iOS Gauge and it has been confirmed as a defect. This fix for this issue will be included in our upcoming volume release. Alternatively the issue can also be resolved by binding the GaugeValue property of gauge instead of binding it to the Pointer value (Applicable only for iOS).

Please let us know if you need any further assistance,

Regards,
Arun

Rune Jensen
Replied On November 5, 2014 02:50 AM

Thank you very much, the workaround will work for us until the new version is ready.

I actually have another problem with the BarChart, where i am trying to change some colors. When i run on Windows phone, it works just fine, but when i deploy on iPhone, the colors are pink when used in the chart. The same color applied to a Label shows the correct color.

The problem comes when using colors defined by either Color.FromRgb or Color.FromHex. When I use the predefined colors such as Color.Blue, it shows the correct color, except for Color.Gray, which still shows as pink. 

Do you have any idea what could be wrong here? 

Karthikeyan V [Syncfusion]
Replied On November 5, 2014 03:34 AM

Hi Rune,


Sorry about the inconvenience caused. 


We are able to reproduce the issue in iOS Xamarin.Forms. We will fix this issue in our next service pack release which will be available at the end of November, 2014.  However, you can resolve this issue by using following workaround,


Code snippet [C#]:


Color color = Color.Gray;

ColumnSeries series = newColumnSeries ();

series.Color = Device.OnPlatform (Color.FromRgba (color.R / 255, color.G, color.B / 255, color.A / 255), color, color);


We have prepared a sample based on this and you can find the sample in the following location.


Disclaimer: The date for the release is tentative and not a commitment on our parts.


Please let us know if you require further assistance on this.


Regards,

Karthikeyan V


Attachment: SimpleChartSample_9b2b1723.zip

Shashidhar
Replied On March 10, 2015 06:08 AM

I am trying to bind the needle value but value is not binding.How to do  Binding in iOS (working in Android).

Joy Oyiess Rex  K [Syncfusion]
Replied On March 11, 2015 07:14 AM

Hi Shashidhar,

Sorry for the inconvenience caused.

We are able to reproduce the issue with binding the pointer in CircularGauge iOS 64-bit platform. We have resolved the same, please find the respective custom assemblies below,

Custom assemblies for Gauge (iOS): Dll.zip

The fix for this issue will be included in our upcoming release, If the provided solution doesn’t meet your requirement, could you please provide us a simple issue reproducing sample, so that we could analyse on it and provide you better solution.

Regards,

Joy Oyiess Rex K



Shashidhar
Replied On March 18, 2015 10:19 AM

Hi Joy, 

Thanks for your reply

After adding the dll from  Dll.zip, i am getting the following Error

Error CS0012: The type `Xamarin.Forms.Platform.iOS.ViewRenderer`2<Syncfusion.SfGauge.XForms.SfCircularGauge,Syncfusion.SfGauge.iOS.SFCircularGauge>' is defined in an assembly that is not referenced. Consider adding a reference to assembly `Xamarin.Forms.Platform.iOS, Version=1.3.1.0, Culture=neutral, PublicKeyToken=null' (CS0012)

Also i am not able to change the StartValue and EndValue based on the value that set to the pointer.

Joy Oyiess Rex  K [Syncfusion]
Replied On March 19, 2015 01:29 AM

Hi Shashidhar,

We are not able to reproduce the mentioned issue from the provided assemblies. We suspect that the mentioned issue is due to the version mismatch in the Xamarin assemblies, so could you please remove and update the Xamarin nuget package again in your project.

If you can't resolve the mentioned issue, could you please provide us an issue reproducing sample, so that we could analyse on it and provide you better solution.

Please let us know, if you have any concerns.

Regards,

Joy Oyiess Rex K


Shashidhar
Replied On March 19, 2015 09:34 AM


I am using following config

=== Xamarin Studio ===

Version 5.8 (build 443)
Installation UUID: 2290c4f3-f2f6-40b3-a173-1eea6645263b
Runtime:
    Mono 3.12.1 ((detached/b7764aa)
    GTK+ 2.24.23 (Raleigh theme)

    Package version: 312010000

=== Apple Developer Tools ===

Xcode 5.0.2 (3335.32)
Build 5A3005

=== Xamarin.iOS ===

Version: 8.8.0.2 (Indie Edition)
Hash: ccfcd59
Branch:
Build date: 2015-03-10 02:20:32-0400

=== Xamarin.Android ===

Version: 4.20.0.37 (Indie Edition)
Android SDK: /Users/krish/Library/Developer/Xamarin/android-sdk-mac_x86
    Supported Android versions:
        2.1   (API level 7)
        2.2   (API level 8)
        2.3   (API level 10)
        3.1   (API level 12)
        4.0   (API level 14)
        4.0.3 (API level 15)
        4.2   (API level 17)
        4.3   (API level 18)
        4.4   (API level 19)
        5.0   (API level 21)
Java SDK: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)



Xamarin.forms 1.3.1.6296



Joy Oyiess Rex  K [Syncfusion]
Replied On March 20, 2015 01:05 PM


Hi Shashidhar,

Could you please update your xcode to latest version and revert us back if the issue exist even after that. And also please share the reproducing samples so that we could analyse on it and provide you better solution.

Please let us know, if you have any concerns.

Regards,
Joy Oyiess Rex K

Shashidhar
Replied On April 2, 2015 08:50 AM

Is there any way other than updating XCode since i can't update XCode, and i forgot to mention that i am using trial version of Syncfusion.

Thanks in advance.

Joy Oyiess Rex  K [Syncfusion]
Replied On April 6, 2015 03:37 AM

Hi Shashidhar,

Sorry for the delay in get back to you.

You can use our updated Xamarin forms assemblies which is available for download under the following link:

http://www.syncfusion.com/forums/118723/essential-studio-2015-volume-1-final-release-v13-1-0-21-available-for-download

If the mentioned issue occurred even after updated to our latest version, then please update your xcode to latest version to resolve the mentioned issue.

Please let us know, if you have any concerns.

Regards,

Joy Oyiess Rex K


Shashidhar
Replied On April 10, 2015 06:30 AM

Hi,

I found the solution for binding needle value. What i did is, assigned BindingContext property for needle value too, but i am not able to change the StartValue and EndValue propety in iOS not even in your given example( able to set in Android),i think it may be because i am using Xcode 5.0.2 which i can't update to newer version since i am using Mountain Lion (Version 10.8.5) in VMWarePlayer (Version 5.0.0 build-812388).

Thanks for your support

Regards,
Shashidhar K

Nijamudeen Mohamed Sulaiman [Syncfusion]
Replied On April 13, 2015 09:02 AM

Hi Shashidhar,


The reported issue has been fixedand we have created a new incident for follow up. You can download the custom assemblies for the fix from the incident.


Please let us know if you have any queries.


Thanks,
Nijamudeen M.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;