This is a migrated thread and some comments may be shown as answers.
Use DataForm with TabView
1 Answer 16 Views
This is a migrated thread and some comments may be shown as answers.
Vikram
Top achievements
Rank 1
Vikram asked on 06 Feb 2018, 07:25 PM

Is this currently possible, and if so how? 

 

I assumed I could Create the RadTabView, and for each of my tabs have a separate dataform, and just create code like this?

 

        <telerikInput:RadDataForm.Source>
            <local:SourceItem />
        </telerikInput:RadDataForm.Source>
    </telerikInput:RadDataForm>

 

However, my compiler errors out saying 'local' is an underclared prefix.

1 Answer, 1 is accepted

Sort by
0
Lance | Manager Technical Support
Telerik team
answered on 08 Feb 2018, 10:59 PM
Hi Vikram,

In that context local: means the namespace of where the SourceItem class is. You'd need to add an xmlns to the page pointing to the "local" namespace.

Example
Let's say as an example, your project namespace is "MyProject" and you have a folder named "Models". IN the Models folder you have a class named "Student".

This is what it would look like if you wanted to use the RadDataForm for Student:

    x:Class="MyProject"
    xmlns:input="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
    xmlns:local="clr-namespace:MyProject.Models;assembly=MyProject">
 
    <Grid>
        <input:RadDataForm>
            <input:RadDataForm.Source>
                <local:Student/>
            <input:RadDataForm.Source>
        </input:RadDataForm>
            
    </Grid>
</ContentPage>


You can name that namespace whatever you want. In fact a more appropriate xmlns for the Models folder would be "xmlns:models"


    x:Class="MyProject"
    xmlns:input="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.XamarinForms.Input"
    xmlns:models="clr-namespace:MyProject.Models;assembly=MyProject">
  
    <Grid>
        <input:RadDataForm>
            <input:RadDataForm.Source>
                <models:Student/>
            <input:RadDataForm.Source>
        </input:RadDataForm>
             
    </Grid>
</ContentPage>


Code Behind

If you're not familiar with XAML and how define xmlns, you can set the Source property of the DataForm in the code behind:

<input:RadDataForm x:Name="myDataForm1">
    <input:RadDataForm.Source>
        <models:Student/>
    <input:RadDataForm.Source>
</input:RadDataForm>

myDataForm.Source = new Student();


View Model

Lastly, you can also data bind the Source property:

<input:RadDataForm Source="{Binding SelectedStudent}" />

and in the view model:

public class ViewModel
{
    public Student SelectedStudent { get; set; }
}



Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Vikram
Top achievements
Rank 1
Answers by
Lance | Manager Technical Support
Telerik team
Share this question
or