This is a migrated thread and some comments may be shown as answers.

Databinding for RadCycleHubTile

1 Answer 44 Views
HubTile
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ashok
Top achievements
Rank 2
Ashok asked on 19 Oct 2013, 06:28 AM
Hi I'm doing simple phone contact binding to RadCycleHubTile in a MVVM way. But is throwing exception as follows -

   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at System.Collections.Generic.List`1.get_Item(Int32 index)
   at System.Collections.ObjectModel.Collection`1.System.Collections.IList.get_Item(Int32 index)
   at Telerik.Windows.Controls.EnumerableExtensions.ElementAt(IEnumerable enumerable, Int32 index)
   at Telerik.Windows.Controls.RadCycleHubTile.GetRandomItem()
   at Telerik.Windows.Controls.RadCycleHubTile.GetItem(Boolean random)
   at Telerik.Windows.Controls.RadCycleHubTile.OnFullyInitialized()
   at Telerik.Windows.Controls.HubTileBase.OnLoaded(Object sender, RoutedEventArgs e)
   at MS.Internal.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)

Below are my binding details
Namespace -  xmlns:tp="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"

 <tp:RadCycleHubTile ItemsSource="{Binding Items}" x:Name="tileAll" Title="All" Margin="6"  Background="Red"
                Width="450" IsFrozen="True"
                Height="150" >
                <tp:RadCycleHubTile.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="0, 12, 0, 0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="140"/>
                            </Grid.ColumnDefinitions>
                          
                            <TextBlock Text="{Binding DisplayName}" Style="{StaticResource PhoneTextLargeStyle}"
                                           TextWrapping="Wrap"
                                           Margin="12, 0, 0, 0"
                                           Grid.Column="1"
                                           VerticalAlignment="Center"
                                           HorizontalAlignment="Left"/>
                        </Grid>
                    </DataTemplate>
                </tp:RadCycleHubTile.ItemTemplate>
            </tp:RadCycleHubTile>

I have singletone MainViewModel

  public class MainViewModel : INotifyPropertyChanged
    {
        public MainViewModel()
        {
            Items = new ObservableCollection<Contact>();
        }

        private ObservableCollection<Contact> _items = new ObservableCollection<Contact>();
   
        public ObservableCollection<Contact> Items
        {
            get
            {
                return _items;
            }
            set
            {
                if (value != _items)
                {
                    _items = value;
                    NotifyPropertyChanged("Items");
                }
            }
        }

        public bool IsDataLoaded
        {
            get;
            private set;
        }
    
        public void LoadData()
        {
            Contacts c = new Contacts();

            c.SearchCompleted += (s, e) =>
            {
                Items = new ObservableCollection<Contact>(e.Results);
            };
            c.SearchAsync(string.Empty, FilterKind.None, null);

            this.IsDataLoaded = true;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }

How should I handle this?

1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 23 Oct 2013, 07:43 AM
Hello Ashok,

Thank you for contacting us. I was unable to reproduce the issue. Could you please take a look at the attached files and let me know if I'm missing anything. I'd be glad to assist you further.  

Regards,
Kiril Stanoev
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
HubTile
Asked by
Ashok
Top achievements
Rank 2
Answers by
Kiril Stanoev
Telerik team
Share this question
or