views that have relationships to or from them must be kept in the relativelayout error while set itemssource

I have a sfDataGrid inside stacklayout and the stacklayout is inside relativelayout, when I tried to set itemssource to the datagrid an error "Views that have relationships to or from them must be kept in the RelativeLayout" ocurred and the app closes, how the views must be placed inside the relativelayout.

<?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:syncfusion="clr-namespace:Syncfusion.SfDataGrid.XForms;assembly=Syncfusion.SfDataGrid.XForms" 
             x:Class="DemoActivos.Levantamiento"
             Title="Levantamiento"
             BackgroundColor="White">

    <ContentPage.Content>
        
        <RelativeLayout x:Name="relativeLayout">
            <!--Scroll-->
            <ScrollView x:Name="scroll" Orientation="Vertical"
                        RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1, Constant=0}"
                        RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1, Constant=0}">
                <ScrollView.Margin>
                    <OnPlatform x:TypeArguments="Thickness">
                        <On Platform="Android" Value="20, 20, 20, 20"/>
                        <On Platform="iOS" Value="20, 40, 20, 20"/>
                    </OnPlatform>
                </ScrollView.Margin>
                <!--Stack-->
                <StackLayout x:Name="stackLayout" Orientation="Vertical" Spacing="15" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand">
                    <StackLayout HorizontalOptions="FillAndExpand" Orientation="Horizontal">
                        <Label x:Name="lblEmpleado" HorizontalOptions="StartAndExpand" FontSize="Large" />
                    </StackLayout>
                    <!--Empleado-->
                    <StackLayout HorizontalOptions="FillAndExpand" Orientation="Horizontal">
                        <Entry x:Name="EntryEmpleado" Placeholder="Numero empleado" PlaceholderColor="LightGray" 
                       HorizontalOptions="FillAndExpand" TextChanged="EntryEmpleado_TextChanged" />
                        <Image x:Name="imgSearchEmployee" Source="buscar.png" HorizontalOptions="End" WidthRequest="35" HeightRequest="35"/>
                    </StackLayout>
                    <!--Nombre empleado-->
                    <StackLayout HorizontalOptions="FillAndExpand" Orientation="Horizontal">
                        <Entry x:Name="EntryEmpleadoNombre" Placeholder="Nombre empleado" PlaceholderColor="LightGray" IsEnabled="false"
                               HorizontalOptions="FillAndExpand"/>
                        <Image x:Name="imgUsuario" Source="usuario.png" HorizontalOptions="End" WidthRequest="35" HeightRequest="35"/>
                    </StackLayout>
                    <!--Data Grid-->
                    <syncfusion:SfDataGrid x:Name="DataGrid" ColumnSizer="Star" AutoGenerateColumns="False"
                                           VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" >
                        <syncfusion:SfDataGrid.Columns x:TypeArguments="syncfusion:Columns">
                            <syncfusion:GridTextColumn HeaderText="ActivoId" MappingName="ActivoId" IsHidden="True" />
                            <syncfusion:GridTextColumn HeaderText="Co. barras" MappingName="CodigoBarrasParticular" />
                            <syncfusion:GridTextColumn HeaderText="Estatus" MappingName="NombreEstatus" />
                            <syncfusion:GridImageColumn HeaderText="Validacion" MappingName="EstatusIdSource" />
                            <syncfusion:GridTextColumn HeaderText="Estatus Id" MappingName="EstatusId" IsHidden="True" />
                        </syncfusion:SfDataGrid.Columns>
                    </syncfusion:SfDataGrid>
                </StackLayout>
            </ScrollView>
            <!--Codigo de barras-->
            <Frame x:Name="frameCodigoBarras" BackgroundColor="{ StaticResource primaryColor }" 
                   Opacity="0.5" CornerRadius="5" Padding="5,5,5,5" IsVisible="True" HeightRequest="55"
                   RelativeLayout.XConstraint="{ConstraintExpression Type=RelativeToParent, Property=X, Factor=1, Constant=0}"
                   RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1, Constant=-70}"
                   RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1, Constant=0}">
                <StackLayout x:Name="stackLayoutCodigoBarras" Orientation="Horizontal"
                             HorizontalOptions="FillAndExpand">
                    <Entry x:Name="EntryCodigoBarras" Placeholder="Codigo de barras" PlaceholderColor="LightGray" 
                               HorizontalOptions="FillAndExpand" TextColor="Gray"/>
                    <Image x:Name="imgScanner" Source="escaner.png" HorizontalOptions="End" HeightRequest="45" WidthRequest="45" />
                </StackLayout>
            </Frame>
            <!--Fondo del load-->
            <ContentView x:Name="LoadBackGround" BackgroundColor="#222222" Opacity="0.5" IsVisible="False"
                         RelativeLayout.WidthConstraint="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
                         RelativeLayout.HeightConstraint="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"/>
            <!--Load-->
            <ActivityIndicator x:Name="Load">
                <RelativeLayout.XConstraint>
                    <OnPlatform x:TypeArguments="Constraint" Android="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=.45}"
                                    iOS="{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=.5}"/>
                </RelativeLayout.XConstraint>
                <RelativeLayout.YConstraint>
                    <OnPlatform x:TypeArguments="Constraint" Android="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=.45}"
                                    iOS="{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=.5}"/>
                </RelativeLayout.YConstraint>
            </ActivityIndicator>
        </RelativeLayout>
    </ContentPage.Content>
</ContentPage>

1 Reply

AN Ashok N Syncfusion Team October 19, 2017 05:35 PM UTC

Hi Abraham,  
  
Thanks for contacting Syncfusion support.  
  
We have checked the reported issue by loading our SfDataGrid inside StackLayout and StackLayout has been loaded inside ScrollView and ScrollView loaded inside RelativeLayout, based on your code snippet in 15.3.0.33 but we are not able to reproduced the issue, SfDataGrid loaded properly. For your reference we have attached sample in the below location, please check it. Could you please do revert us by modifying our sample to replicate the issue or share your sample along with replication procedure, also please share your Xamarin.Forms and SfDataGrid product version and tested devices details, that would be more helpful for us to proceed further.   
     
  
Regards,  
Ashok  


Loader.
Up arrow icon