Hi
please try this,
c#
using
System.Collections.Generic;
using
System.Windows.Controls;
namespace
TestSilverlightApplication
{
using
Telerik.Windows.Controls;
using
ViewModelBase = GalaSoft.MvvmLight.ViewModelBase;
public
partial
class
MainPage1 : UserControl
{
public
MainPage1()
{
InitializeComponent();
}
}
public
class
MainViewModel :ViewModelBase
{
public
MainViewModel()
{
TileViewModels =
new
List<TileViewModel>
{
new
TileViewModel() { Header =
"h1"
, SmallContent =
"small1"
, Content =
"normal1"
, LargeContent =
"large1"
, TileState = TileViewItemState.Maximized},
new
TileViewModel() { Header =
"h2"
, SmallContent =
"small2"
, Content =
"normal2"
, LargeContent =
"large2"
},
};
}
public
List<TileViewModel> TileViewModels {
get
;
set
; }
}
public
class
TileViewModel : ViewModelBase
{
public
string
Header {
get
;
set
; }
public
string
SmallContent {
get
;
set
; }
public
string
Content {
get
;
set
; }
public
string
LargeContent {
get
;
set
; }
public
TileViewItemState TileState {
get
;
set
; }
}
}
if you run it, u get null reference exception. the reason i guess is, when the first TileViewItem is created, it is trying to bind to TileState which is set to Max. This will trigger this first tile to maximize itself and also it will try to minimize second tile which have not been created yet.
Regards,
Alex