Deepak
Deepak

Reputation: 21

Dynamically bind a textblock in a looping selector in wp7

I am developing an application where I have a class called UIManager in which there is a method which has an array of data

public void DisplayCatalog(string[] displayName, BitmapImage[] icons)
    {
        DisplayItem.Clear();
        for (int i = 0; i < displayName.Length; i++)
        {
             DisplayItem.Add(new ItemList { WidgetName = displayName[i], Icon = icons[i] });
        }
        NotifyPropertyChanged("UI");
    }

Now I want this data ie;WidgetName to be displayed in my MainPage where I have used a Looping selector.

*<custom:LoopingSelector x:Name="selectorLeft" ItemMargin="5"  ItemSize="145,145" Margin="6,0,-6,22">
            <custom:LoopingSelector.ItemTemplate>
                <DataTemplate>
                    <StackPanel>
                        <TextBlock Text="{Binding WidgetName}"/>
                    </StackPanel>
                </DataTemplate>
            </custom:LoopingSelector.ItemTemplate>
        </custom:LoopingSelector>

* Also I need to scroll the looping selector Horizontally. How can I achieve this...??? Any valuable solutions Please....... I have used Horizontal Looping Selector but I am not getting how to bind the data from my UIManager class on to the Horizontal Looping Selector..

    <toolkit:HorizontalLoopingSelector Grid.Row="0" Margin="12" Height="128"        ItemSize="128,128" ItemTemplate="{StaticResource ?????}">
            <toolkit:HorizontalLoopingSelector.DataSource>
                ????????
                </toolkit:HorizontalLoopingSelector.DataSource>
             </toolkit:HorizontalLoopingSelector>

Upvotes: 0

Views: 988

Answers (1)

Yasvanth U
Yasvanth U

Reputation: 1

You need to create a datasource class and bind the values to the looping selector source. It's similar to binding source to the vertical looping selector.

Upvotes: 0

Related Questions