同一数据表上有多个pickereditor?

时间:2017-09-18 06:21:30

标签: c# xaml xamarin.forms telerik

我对Xamarin以及Xamarin.Forms的Telerik UI控件相对较新。

我试图在同一数据表上的两个不同的模型属性上有两个pickereditors但我似乎无法使这两个数据源工作。我可以让一个或另一个工作,但不是两个。我是否需要为每个数据源使用单独的PropertyDataSourceProvider?

我有以下内容: 的 LoanDetailsPAge.xaml

<?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:input="clr-namespace:Telerik.XamarinForms. and if so how do i achieve thatInput;assembly=Telerik.XamarinForms.Input"
             x:Class="ccnz.mobile.Pages.LoanApplication.LoanDetailsPage">
    <ContentPage.Content>
        <ScrollView>
            <StackLayout>
                <Label Text="Loan Details"/>
                <input:RadDataForm x:Name="loanDetailsDataForm" Source="{Binding LoanDetail}">
                </input:RadDataForm>
                <Button Text="Previous" Clicked="PreviousButtonClicked" />
                <Button Text="Next" Clicked="NextButtonClicked" />
            </StackLayout>
        </ScrollView>
    </ContentPage.Content>
</ContentPage>

和LoanDetailsPage.xaml.cs背后的代码

    public LoanDetailsPage()
    {
        InitializeComponent();

        loanDetailsDataForm.PropertyDataSourceProvider = new LoanReasonPropertyDataSourceProvider();
        //loanDetailsDataForm.PropertyDataSourceProvider = new LoanAmountPropertyDataSourceProvider();
        loanDetailsDataForm.ValidationMode = ValidationMode.OnLostFocus;
        loanDetailsDataForm.CommitMode = CommitMode.Manual;
        loanDetailsDataForm.FormValidationCompleted += ValidateAndGoToNextPage;

        loanDetailsDataForm.RegisterEditor(nameof(LoanDetails.LoanReason), EditorType.PickerEditor);
        loanDetailsDataForm.RegisterEditor(nameof(LoanDetails.LoanAmount), EditorType.PickerEditor);
    }

1 个答案:

答案 0 :(得分:0)

我已经解决了如何使用Telerik SDKBrowser示例中的示例来做到这一点,即传入一个键来指示我想要传回哪个属性。请参阅SDKBrowser解决方案中的SourceItem.cs文件,了解它是如何完成的。