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. Image for the cookie policy date

Navigation Page from MasterDetail Page crashes when SFListView was updated

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 ??

7 Replies

MO mohamed November 29, 2019 03:02 AM

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;
       }

    }
}


MO mohamed November 30, 2019 05:11 AM

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>


HM Hemalatha Marikumar Syncfusion Team December 2, 2019 04:52 AM

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.



MO mohamed December 2, 2019 09:51 AM

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.


HM Hemalatha Marikumar Syncfusion Team December 3, 2019 04:38 AM

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. 



MO mohamed December 3, 2019 04:59 AM

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.


HM Hemalatha Marikumar Syncfusion Team December 4, 2019 01:25 AM

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. 


Loader.
Live Chat Icon For mobile
Up arrow icon