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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Navigation Page from MasterDetail Page crashes when SFListView was updated

Thread ID:

Created:

Updated:

Platform:

Replies:

149543 Nov 29,2019 10:24 AM UTC Dec 4,2019 09:25 AM UTC Xamarin.Forms 7
loading
Tags: SfComboBox
mohamed
Asked On November 29, 2019 10:24 AM UTC

Hi All,

When i try to go to Navigation Page from masterdetail it works fine in 1st time when SfListView wasn't updated , and after updating the SfListView and try to go to NavigationPage Again the App Crashes with that error

Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code).

Unhandled Exception:

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

any help for that issue please ??

mohamed
Replied On November 29, 2019 11:02 AM UTC

Hi Again,

I found the problem was the i use inside the SfListView a Custome render control for the SfComboBox and after switching back to the original rendering it works fine ,
but i need to use the custom render for the SfComboBox to use local to use RTL inside the SfListView on IOS , any help please ?

[assembly: ExportRenderer(typeof(CustomComboBox), typeof(CustomRenderer))]
namespace App7.iOS.Renderers
{
    public class CustomRenderer : SfComboBoxRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<SfComboBox> e)
        {
            base.OnElementChanged(e);
            if (CrossMultilingual.Current.CurrentCultureInfo.EnglishName == "Arabic")
                Control.TextField.TextAlignment = UIKit.UITextAlignment.Right;
            else            
                Control.TextField.TextAlignment = UIKit.UITextAlignment.Left;
       }

    }
}

mohamed
Replied On November 30, 2019 01:11 PM UTC

Hi Agian,

I just recognized that when i use the Local:CustomComboBox in any navigation page and then try to navigate to another page in IOS the Application Crashing, I dont know why and this is my Local:CustomComboBox how i use:

so the problem wasn't with the list view

<border:SfBorder
                                    Grid.Row="1"
                                    Grid.Column="0"
                                    Padding="6,0,0,0"
                                    BorderColor="{Binding Source={x:Reference ddlMonths}, Path=IsFocused, Converter={StaticResource ColorConverter}, ConverterParameter=3}"
                                    Style="{StaticResource FormBorderStyle}">
                                    <local:CustomComboBox
                                        x:Name="ddlMonths"
                                        Style="{StaticResource ComboBoxStyle}"
                                        Watermark="إختر الشهر"
                                        MaximumDropDownHeight = "180">
                                        <combobox:SfComboBox.DropDownButtonSettings>
                                            <combobox:DropDownButtonSettings Width="30" Height="30">
                                                <combobox:DropDownButtonSettings.View>
                                                    <Label
                                                        Margin="0"
                                                        FontFamily="{StaticResource FontIcons}"
                                                        FontSize="25"
                                                        HorizontalTextAlignment="Center"
                                                        Text="{StaticResource DropDownButtonIcon}"
                                                        TextColor="{DynamicResource Gray-600}"
                                                        VerticalTextAlignment="Center"
                                                            />
                                                </combobox:DropDownButtonSettings.View>
                                            </combobox:DropDownButtonSettings>
                                        </combobox:SfComboBox.DropDownButtonSettings>
                                        <combobox:SfComboBox.DropDownHeaderView>
                                            <StackLayout BackgroundColor="#f0f0f0" >
                                                <Label  Text="اختر الشهر" FontSize="20" VerticalTextAlignment="Center" HorizontalOptions="Center" VerticalOptions="Center" TextColor="#006bcd" />
                                            </StackLayout>
                                        </combobox:SfComboBox.DropDownHeaderView>
                                    </local:CustomComboBox>
                                </border:SfBorder>

Hemalatha Marikumar [Syncfusion]
Replied On December 2, 2019 12:52 PM UTC

Hi Mohamed,

 

Greetings from Syncfusion.

 

Query: “when i use the Local:CustomComboBox in any navigation page and then try to navigate to another page in IOS the  Application Crashing,

 

We analyzed the reported issue, and this could be occurred due to that when you navigate from one page to another page. This seems to be a sample level issue. Please modified code snippet to resolve the reported issue

 

Code snippet[C#]:

if (Control != null)
            {

 

                if (CrossMultilingual.Current.CurrentCultureInfo.EnglishName == "Arabic")
                    Control.TextField.TextAlignment = UIKit.UITextAlignment.Right;
                else
                    Control.TextField.TextAlignment = UIKit.UITextAlignment.Left;
            }

 

We have prepared the sample based on the provided code snippet. Please have the sample from the following

 

Sample:  https://www.syncfusion.com/downloads/support/forum/149543/ze/SfComboBoxSample-863830929  

 

Please let us know if you have any other concern.

 

Regards,

Hemalatha M.


mohamed
Replied On December 2, 2019 05:51 PM UTC

Hi Hemalatha Marikumar ,

Thanks for your response, your sample is working fine in IOS  (GREAT ANSWER) and i changed my code to your's thanks alot  , but i have another request,
is there is a way to do same customeComboBox render to andriod also? it works automatically on Andriod RTL but i need to Center the header and the collection List 

Control.TextField.TextAlignment = UIKit.UITextAlignment.Center;

I Need to apply this to Andriod Also , is there is a way to apply ?

Thanks.

Hemalatha Marikumar [Syncfusion]
Replied On December 3, 2019 12:38 PM UTC

Hi Mohamed, 
  
We have prepared the sample based on your requirement in Android using custom renderer. 
 
Code Snippet [C#]: CustomRendererComboBox in Android: 
 
public class ComboBoxRendererAndroid : SfComboBoxRenderer 
    { 
        public ComboBoxRendererAndroid(Context context) : base(context) 
        { 
  
        } 
        protected override void OnElementChanged(ElementChangedEventArgs<SfComboBox> e) 
        { 
            base.OnElementChanged(e); 
            if (Control != null) 
            { 
                Control.GetAutoEditText().Gravity = GravityFlags.Left; 
            } 
        } 
    } 
 
Code Snippet [XAML]: ItemDetailPage.XAML 
 
 
<local:CustomComboBox 
                                        x:Name="ddlMonths"       
                                        ShowBorder="False" 
                                        Watermark="إختر الشهر" 
                                        MaximumDropDownHeight = "180"> 
                                        <local:CustomComboBox.ComboBoxSource> 
 
 
Note: To have a better UI, please ignore the border of SfComboBox since you have added the control inside the SfBorder. 
 
Please have the sample from the following 
 
  
Refer the below KB for more information about custom renderer. 
 
 
Please let us know, if you have any other concerns. 
 
Regards, 
Hemalatha M. 


mohamed
Replied On December 3, 2019 12:59 PM UTC

Hello,

Thanks alot your sample worked fine and i applied to my Application and it worked well , Thanks for the fast replying , I am so happy to use Syncfusion controls with this perfect support,  Syncfusion is the best , thanks.

Hemalatha Marikumar [Syncfusion]
Replied On December 4, 2019 09:25 AM UTC

Hi Mohamed, 
 
Thanks for your feedback. 
 
We glad to hear that given solution works. 
 
Please let us know if you need any further assistance. 
 
Regards, 
Hemalatha 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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon