Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
229
xamCarouselListBox databinding using Item Template
posted

I am trying to create an item template to bind to a datatabel and use it in the xamCarouselListBox in code C#.

I would like to create a stackpanel with the items I want on it that bind to a datatable. Something like

 AggregationDataView is a DataView

DataTemplate tmpData = new DataTemplate{ DataType = typeof(string) };

StackPanel sp = new StackPanel { Orientation = System.Windows.Controls.Orientation.Vertical };foreach (DataColumn col in AggregationDataView.Table.Columns)

{

TextBlock tbItem = new TextBlock { ToolTip = col.ColumnName };

tbItem.SetBinding(TextBlock.TextProperty, col.ColumnName);

sp.Children.Add(tbItem);

}

tmpData.Resources.Add(sp,
null);

xamCarouselListBox1.ItemTemplate = tmpData;

xamCarouselListBox1.ItemsSource = AggregationDataView.Table.DefaultView;

 

Doesnt seem to work can you help?

thanks

Mark

  • 69686
    posted

    Hello Mark,

    You can check the samples in the XamFeatureBrowser about the XamCarouselListBox. There is a great example of custom DataTemplate. You can also see the default styles of the controls that we ship in the local directory ~\Infragistics\NetAdvantage for WPF 2008 Vol. 2\DefaultStyles on your computer and build you styles and templates on this base.

    Hope this helps.