Binding custom values in a list picker

4 posts, 0 answers
  1. Simon
    Simon avatar
    11 posts
    Member since:
    Mar 2020

    Posted 14 Jul Link to this post

    for simplicity i have simplified this as much as possible.

     

    I have a rad list with a number of different custom ListViewTemplateCell.View s one includes a custom version of the rad picker. I have created a bindable property (callled test below) which fires the first time the control is created but never fires after the bound value is updated (called AField for simplicity). I am calling OnPropertyChanged  for this field from the rows binding which I can confirm is working

     

    if i take this all and put it into another custom control (based on radentry) on the same row it is working fine. Is this something that can be achieved with the picker control or will it not pick up properties changed like this?

    ////////////////////

     

     

                                    <controls:DSRadPicker Grid.Column="0" Grid.Row="1" Test ="{Binding  AField, Mode=OneWay}"  DSSelectionChanged="DSRadPicker_SelectionChanged" />

     

    public partial class DSRadPicker : RadListPicker 
        {

     public static readonly BindableProperty DSBindingProperty = BindableProperty.Create( 
                 nameof(DSBinding),
                 typeof(DSFormPickerListLine2),
                 typeof(DSRadPicker),
                 defaultValue: null,
                 defaultBindingMode: BindingMode.TwoWay,
                propertyChanged: BindingPropertyChanged
            );

            public static readonly BindableProperty TestProperty =
                   BindableProperty.CreateAttached(
                        nameof(Test),
                 typeof(string),
                 typeof(DSRadPicker),
                       "",
                       BindingMode.TwoWay,
                       null,
                       propertyChanged: HandleTextChanged);


            public string Test
            {
                get { return (string)GetValue(TestProperty); }
                set { SetValue(TestProperty, value); }
            }

            static void HandleTextChanged(BindableObject bindable, object oldValue, object newValue)
            {
                
            }

    }

  2. Didi
    Admin
    Didi avatar
    343 posts

    Posted 14 Jul Link to this post

    Hi Simon,

    Thank you for the provided code.

    As you are positioning the custom ListPicker control inside the ListView control, please keep in mind that the listview cells are recycled when whey go outside of the viewport.

    In order to update the value, I suggest you set a two-way binding mode of the AField property. As I am not familiar with the exact setup you have I can suggest you implement INotifyPropertyChanged interface for the business model and also use ObservableCollection for the Listpicker ItemsSource. 

    Note that RadEntry and RadListPicker are two different controls. The RadListPicker is similar to listview control, it has ItemsSource, SelectedItem, but the list of items is visualized inside the popup. When the item is picked it is displayed inside the picker control. 

    Next Steps:

    If the issue still observes, please open a support ticket and attach a sample repro project in it. I am asking about this as In the forum only image attachments are allowed.

    Once we are aware of the exact setup you have and reproduce the behavior on our side we will be able to investigate the issue further and provide more information on the matter. 

    In addition, could you please elaborate more on the scenario you want to achieve positioning ListPicker inside ListView cell?

    I look forward to your reply.

    Regards,
    Didi
    Progress Telerik

  3. Simon
    Simon avatar
    11 posts
    Member since:
    Mar 2020

    Posted 14 Jul in reply to Didi Link to this post

    I have tried the 2 way binding and that doesnt help. i use observable collections throughout

    how big of an attachment do you support?

     

    I think it is something to do with INotifyProperty not being implemented the same way in Radpicker a Rad entry. 

     

    DSRadPicker  contains a bindable field that i pass in the data and it then has the hook into its own viewcontroller from there

          <DataTemplate>
                        <telerikListView:ListViewTemplateCell  >
                            <telerikListView:ListViewTemplateCell.View  >
                                <Grid Style="{StaticResource SidePaddedGridStyle}" Margin="0" 
                                      >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="100*" />
                                    </Grid.ColumnDefinitions>

                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="40" />
                                        <RowDefinition Height="*" />
                                    </Grid.RowDefinitions>

                                    <StackLayout Grid.Column="0" Grid.Row="0"  Orientation="Horizontal">
                                        <Label   Style="{StaticResource boldBlackLabelStyle}" Text="{Binding  ListLine.Label}"/>
                                        <controls:DSRadEntry TextColor="{StaticResource IndigoColor}" Test ="{Binding  TestField, Mode=OneWay}" Text="test"></controls:DSRadEntry >
                                        <Label   Style="{StaticResource boldLabelStyle}" Text="*" IsVisible="{ Binding ListLine.Required, Converter={StaticResource EditableConverter}}"/>
                                    </StackLayout>
    >
                                    <controls:DSRadPicker Grid.Column="0" Grid.Row="1" Test ="{Binding  TestField, Mode=OneWay}"  DSSelectionChanged="DSRadPicker_SelectionChanged" DSBinding="{ Binding  ListLine}" />
                                </Grid>
                            </telerikListView:ListViewTemplateCell.View>
                        </telerikListView:ListViewTemplateCell>
                    </DataTemplate>

  4. Didi
    Admin
    Didi avatar
    343 posts

    Posted 15 Jul Link to this post

    Hi Simon,

    You can upload files up to 20 MB. I have created a support ticket on your behalf. The ticket id is 1476287. I will send a reply to the support ticket. 

    Regards,
    Didi
    Progress Telerik

Back to Top