I'm using Telerik Linear Guage to show the Accelerometer. I have three Gauge for X,Y,Z coordinates respectively.
The problem is with the value binding. I used the following code to bind the values, but it is not working,
//CodeBehind
public string XCord { get; set; }
public string YCord { get; set; }
public string ZCord { get; set; }
// Constructor
public MainPage()
{
InitializeComponent();
acc = new Accelerometer();
acc.CurrentValueChanged += acc_CurrentValueChanged;
acc.Start();
}
void acc_CurrentValueChanged(object sender, SensorReadingEventArgs<AccelerometerReading> e)
{
XCord = Math.Abs(acc.CurrentValue.Acceleration.X).ToString();
YCord = Math.Abs(acc.CurrentValue.Acceleration.Y).ToString();
ZCord = Math.Abs(acc.CurrentValue.Acceleration.Z).ToString();
}
<!--XAML CODE-->
<gauges:MarkerGaugeIndicator Value="57.67"
gauges:LinearGaugeRange.IndicatorOffset="40"
x:Name="indicator5"
IsAnimated="True"
IsMarkerRotated="False">
<gauges:MarkerGaugeIndicator.MarkerTemplate>
<DataTemplate>
<Grid Width="37"
Height="37">
<TextBlock x:Name="txt1" Text="{Binding XCord}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="13"
FontWeight="Bold"/>
</Grid>
</DataTemplate>
</gauges:MarkerGaugeIndicator.MarkerTemplate>
</gauges:MarkerGaugeIndicator>
<gauges:MarkerGaugeIndicator Value="57.67"
gauges:LinearGaugeRange.IndicatorOffset="40"
x:Name="indicator6"
IsAnimated="True"
IsMarkerRotated="False">
<gauges:MarkerGaugeIndicator.MarkerTemplate>
<DataTemplate>
<Grid Width="37"
Height="37">
<TextBlock x:Name="txt2" Text="{Binding YCord}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="13"
FontWeight="Bold"/>
</Grid>
</DataTemplate>
</gauges:MarkerGaugeIndicator.MarkerTemplate>
</gauges:MarkerGaugeIndicator>
<gauges:MarkerGaugeIndicator Value="57.67"
gauges:LinearGaugeRange.IndicatorOffset="40"
x:Name="indicator7"
IsAnimated="True"
IsMarkerRotated="False">
<gauges:MarkerGaugeIndicator.MarkerTemplate>
<DataTemplate>
<Grid Width="37"
Height="37">
<TextBlock x:Name="txt3" Text="{Binding ZCord}"
VerticalAlignment="Center"
HorizontalAlignment="Center"
FontSize="13"
FontWeight="Bold"/>
</Grid>
</DataTemplate>
</gauges:MarkerGaugeIndicator.MarkerTemplate>
</gauges:MarkerGaugeIndicator>
Somebody say me how to bind the value of the coordinates with the control.
Related
I have a dto,method and xaml file below. The method returns duplicates which is fine. I only want to display one on my xaml page. I used a groupby and I was able
to display one item but the values for RouteNbr and Day are not displayed on the xaml page.
Do you know what am doing wrong?
public class CSDto
{
public Int32 ID { get; set; }
public Int32 RouteNbr { get; set; }
public Int32 Day { get; set; }
public String Month { get; set; }
public String Year { get; set; }
}
private void GetAllCsrActPlansByCsrId(Int32 CssId)
{
try
{
string getCs = Convert.ToString(CssId);
var getRouteInfoProfile = MySol.GetByCustomerNbr(getCs);
var queryResult = getRouteInfoProfile;
grdVwRouteAct.DataContext = queryResult.GroupBy(g=>g.RouteNbr).Distinct();
}
catch (Exception ex)
{
customutility.ApplicationErrorlog(UserID, ex.Message, DateTime.Now.ToString());
}
}
<GridView.ItemTemplate>
<DataTemplate>
<Button Style="{StaticResource CSRProfile}" Margin="0" Padding="0" Height="Auto" Width="Auto" Background="MediumAquamarine">
<StackPanel Tag="cpActionPlanBlock" Width="275" Height="90" HorizontalAlignment="Left" VerticalAlignment="Center" Orientation="Horizontal" Margin="0">
<Image Source="/Assets/Images/CSRProfile-checkicon.gif" Width="49" Height="65" VerticalAlignment="Center" Margin="10"/>
<StackPanel Orientation="Vertical" VerticalAlignment="Center" Margin="10,0">
<StackPanel Orientation="Horizontal">
<TextBlock Tag="cpRouteNumber" Style="{ThemeResource BasicFontStyle4B}" Text="{Binding RouteNbr}" VerticalAlignment="Top" Margin="0,0,0,5"/>
<TextBlock Style="{ThemeResource BasicFontStyle4B}" Text="-" VerticalAlignment="Top" Margin="5,0,5,0"/>
<TextBlock Tag="cpDay" x:Uid="queueItemType" Style="{ThemeResource BasicFontStyle4B}" Text="{Binding Day}" VerticalAlignment="Top" Margin="0,0,0,5"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Tag="cpNumberofActions" Style="{ThemeResource BasicFontStyle4B}" Text="[Y]" VerticalAlignment="Top" Margin="0,0,5,0"/>
<TextBlock Tag="cpLblActions" Style="{ThemeResource BasicFontStyle4B}" Text="Actions" x:Uid="cpActions" VerticalAlignment="Top" Margin="0,0,15,5"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Button>
</DataTemplate>
</GridView.ItemTemplate>
I have a listbox with three values. I need get the FEstado value for all items of ListBox and sum them. However, this ListBox not have defined items, the user select items from another ListBox.
My Listbox:
<ListBox Name="List2" HorizontalContentAlignment="Stretch" Grid.ColumnSpan="3" Margin="0,43,-66,0">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17" Width="432" Height="95" Hold="holdListRmv">
<TextBlock Grid.Column="0" Text="{Binding FNome}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Grid.Column="1" Text="{Binding FEstado}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
<TextBlock Grid.Column="2" Text="{Binding Quantity}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextNormalStyle}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Assuming that you populate the ListBox by adding model item to ListBox's Items property (as shown in your previous question), then you can get all items from the same ListBox.Items property. And assuming that FEstado is a number, you can do something like this :
var items = List2.Items.Cast<Fields>();
var total = items.Sum(o => o.FEstado);
You can do something like this,
try this:
XAML:
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="0">
<StackPanel>
<ListBox Name="List2" HorizontalContentAlignment="Stretch" Grid.ColumnSpan="3" Margin="0,43,-66,0">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,0,0,17" Width="432" Height="95" >
<TextBlock Grid.Column="0" Text="{Binding FNome}" TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"/>
<TextBlock Grid.Column="1" Text="{Binding FEstado}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
<TextBlock Grid.Column="2" Text="{Binding Quantity}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextNormalStyle}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Content="sum" Click="Button_Click_1"></Button>
</StackPanel>
</Grid>
cs:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
ObservableCollection<DataClass> obj = new ObservableCollection<DataClass>();
obj.Add(new DataClass("AA", "10", "10"));
obj.Add(new DataClass("BB", "10", "10"));
List2.ItemsSource = obj;
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
int sum = 0;
for (int i = 0; i < List2.Items.Count; i++)
{
DataClass obj = (DataClass)List2.Items[i];
sum += int.Parse(obj.FEstado.ToString());
}
MessageBox.Show(sum.ToString());
}
public class DataClass
{
public string FNome { get; set; }
public string FEstado { get; set; }
public string Quantity { get; set; }
public DataClass() { }
public DataClass(string FNome, string FEstado, string Quantity)
{
this.FNome = FNome;
this.FEstado = FEstado;
this.Quantity = Quantity;
}
}
I'm struggling to get my head around this, i have a list collection with the following that i'm trying to bind to a GridView;
public class GetMenu
{
public string titleName { get; set; }
public string imagePath { get; set; }
}
List<GetMenu> Menu = new List<GetMenu>()
{
new GetMenu(){titleName = "one", imagePath = "image.jpg"},
new GetMenu(){titleName = "one", imagePath = "image.jpg"}
};
My XAML code looks like;
<GridView x:Name="MenuViewGrid" TabIndex="1"
Grid.RowSpan="2" Padding="116,136,116,46" Margin="0,0,50,0" VerticalAlignment="Center"
SelectionMode="None" IsSwipeEnabled="false" IsItemClickEnabled="True" ItemClick="ItemView_ItemClick">
<GridView.ItemTemplate>
<DataTemplate>
<Grid HorizontalAlignment="Left" Width="275" Height="425" >
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
<Image Source="{Binding Path=imagePath}" Stretch="UniformToFill"/>
</Border>
<StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
<TextBlock Text="{Binding Path=titleName}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" FontSize="25" Height="60" Margin="15,0,15,0"/>
</StackPanel>
</Grid>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
In my head i thought i'd be able to do a simple;
MenuViewGrid.ItemsSource = GetMenu;
But when doing the above i get an error message saying it's a type but i'm trying to use it as a variable. I can't understand this as i've used the code on Windows Phone before.
Replace GetMenu by Menu (GetMenu is your class, Menu is your list):
MenuViewGrid.ItemsSource = Menu;
So, I am on my way learning MVVM Pattern for Windows Phone, and stuck how to bind the View to my ViewModel. App that I build now is getting current and next 5 days weather and display it to one of my panorama item on MainPage.xaml using UserControl.
I cannot just simply set the Forecasts.ItemsSource = forecast; in my WeatherViewModel, it says that Forecasts (Listbox element name in WeatherView) not exist in the current context.
Can anybody teach me how to bind it? and anybody have a good source/example sample to mvvm pattern in windows-phone? Thanks before.
EDIT:
WeatherModel.cs
namespace JendelaBogor.Models
{
public class WeatherModel
{
public string Date { get; set; }
public string ObservationTime { get; set; }
public string WeatherIconURL { get; set; }
public string Temperature { get; set; }
public string TempMaxC { get; set; }
public string TempMinC { get; set; }
public string Humidity { get; set; }
public string WindSpeedKmph { get; set; }
}
}
WeatherViewModel.cs
namespace JendelaBogor.ViewModels
{
public class WeatherViewModel : ViewModelBase
{
private string weatherURL = "http://free.worldweatheronline.com/feed/weather.ashx?q=";
private const string City = "Bogor,Indonesia";
private const string APIKey = "APIKEY";
private IList<WeatherModel> _forecasts;
public IList<WeatherModel> Forecasts
{
get
{
if (_forecasts == null)
{
_forecasts = new List<WeatherModel>();
}
return _forecasts;
}
private set
{
_forecasts = value;
if (value != _forecasts)
{
_forecasts = value;
this.NotifyPropertyChanged("Forecasts");
}
}
}
public WeatherViewModel()
{
WebClient downloader = new WebClient();
Uri uri = new Uri(weatherURL + City + "&num_of_days=5&extra=localObsTime&format=xml&key=" + APIKey, UriKind.Absolute);
downloader.DownloadStringCompleted += new DownloadStringCompletedEventHandler(ForecastDownloaded);
downloader.DownloadStringAsync(uri);
}
private void ForecastDownloaded(object sender, DownloadStringCompletedEventArgs e)
{
if (e.Result == null || e.Error != null)
{
MessageBox.Show("Cannot load Weather Forecast!");
}
else
{
XDocument document = XDocument.Parse(e.Result);
var current = from query in document.Descendants("current_condition")
select new WeatherModel
{
ObservationTime = DateTime.Parse((string)query.Element("localObsDateTime")).ToString("HH:mm tt"),
Temperature = (string)query.Element("temp_C"),
WeatherIconURL = (string)query.Element("weatherIconUrl"),
Humidity = (string)query.Element("humidity"),
WindSpeedKmph = (string)query.Element("windspeedKmph")
};
this.Forecasts = (from query in document.Descendants("weather")
select new WeatherModel
{
Date = DateTime.Parse((string)query.Element("date")).ToString("dddd"),
TempMaxC = (string)query.Element("tempMaxC"),
TempMinC = (string)query.Element("tempMinC"),
WeatherIconURL = (string)query.Element("weatherIconUrl")
}).ToList();
}
}
}
}
WeatherView.xaml
<UserControl x:Class="JendelaBogor.Views.WeatherView"
xmlns:vm="clr-namespace:JendelaBogor.ViewModels">
<UserControl.DataContext>
<vm:WeatherViewModel />
</UserControl.DataContext>
<Grid Margin="0,-10,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="Current" Grid.Row="0" Height="150" VerticalAlignment="Top">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Image Grid.Column="0" delay:LowProfileImageLoader.UriSource="{Binding WeatherIconURL}" Width="120" Height="120" VerticalAlignment="Top"/>
<StackPanel Grid.Column="1" Height="200" VerticalAlignment="Top">
<TextBlock Text="{Binding Temperature}" FontSize="22"/>
<TextBlock Text="{Binding ObservationTime}" FontSize="22"/>
<TextBlock Text="{Binding Humidity}" FontSize="22"/>
<TextBlock Text="{Binding Windspeed}" FontSize="22"/>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Height="300" VerticalAlignment="Bottom" Margin="10,0,0,0">
<StackPanel VerticalAlignment="Top">
<StackPanel Height="40" Orientation="Horizontal" Margin="0,0,0,0">
<TextBlock Text="Date" FontSize="22" Width="170"/>
<TextBlock Text="FC" FontSize="22" Width="60"/>
<TextBlock Text="Max" TextAlignment="Right" FontSize="22" Width="90"/>
<TextBlock Text="Min" TextAlignment="Right" FontSize="22" Width="90"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
<ListBox ItemsSource="{Binding Forecasts}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Height="40" Orientation="Horizontal" Margin="0,10,0,0">
<TextBlock Text="{Binding Date}" FontSize="22" TextAlignment="Left" Width="170" />
<Image delay:LowProfileImageLoader.UriSource="{Binding WeatherIconURL}" Width="40" Height="40" />
<TextBlock Text="{Binding TempMaxC, StringFormat='\{0\} °C'}" TextAlignment="Right" FontSize="22" Width="90" />
<TextBlock Text="{Binding TempMinC, StringFormat='\{0\} °C'}" TextAlignment="Right" FontSize="22" Width="90" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</StackPanel>
</Grid>
</Grid>
</UserControl>
MainPage.xaml
<controls:PanoramaItem x:Name="Weather" Header="weather">
<views:WeatherView />
</controls:PanoramaItem>
You need to tell the view what viewmodel you are using. By adding
<UserControl
xmlns:vm="clr-namespace:JendelaBogor.ViewModels">
<UserControl.DataContext>
<vm:WeatherViewModel />
</UserControl.DataContext>
</UserControl>
all {Binding}'s are mapped to the class WeatherViewModel. By using the ItemsSource property on the listbox as Reed suggests you can then bind all items from a list that you expose through a property.
If the list is ever changed while running the application, consider using an ObservableCollection and clearing it and adding all new items when new data is received. If you do, your GUI will simply update with it.
The ViewModel doesn't know about the view.
You need to make a Forecasts property on the ViewModel, and bind the ItemsSource to it from your View. In your view, change the ListBox to:
<!-- No need for a name - just add the binding -->
<ListBox ItemsSource="{Binding Forecasts}">
Then, in your ViewModel, add:
// Add a backing field
private IList<WeatherModel> forecasts;
// Add a property implementing INPC
public IList<WeatherModel> Forecasts
{
get { return forecasts; }
private set
{
forecasts = value;
this.RaisePropertyChanged("Forecasts");
}
}
You can then set this in your method:
this.Forecasts = (from query in document.Descendants("weather")
select new WeatherModel
{
Date = DateTime.Parse((string)query.Element("date")).ToString("dddd"),
TempMaxC = (string)query.Element("tempMaxC"),
TempMinC = (string)query.Element("tempMinC"),
WeatherIconURL = (string)query.Element("weatherIconUrl")
})
.ToList(); // Turn this into a List<T>
I have tried for several hours and searching on the net for examples on how to pull multiple elements with the same name however different attributes and binding those to my XAML in my app for wp7,
the easiest way for me to explain is to simply show you,
heres what I have so far
public class Match
{
public string HomeTeam { get; set; }
public string AwayTeam { get; set; }
public string HomeScore { get; set; }
public string AwayScore { get; set; }
public string GoalsPlayer { get; set; }
public string goal { get; set; }
public string GoalsTime { get; set; }
public string DismissalsPlayer { get; set; }
public string DismissalsTime { get; set; }
public string BookingPlayer { get; set; }
public string BookingTime { get; set; }
public string GameTime { get; set; }
}
void wc_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
{
XElement element = XElement.Parse(e.Result);
try
{
listBox2.ItemsSource = from item in element.Descendants("competition")
from match in item.Elements("match").Where(arg => arg.Attribute("awayTeam").Value == team | arg.Attribute("homeTeam").Value == team)
select new Match
{
HomeTeam = (string)match.Attribute("homeTeam"),
AwayTeam = (string)match.Attribute("awayTeam"),
HomeScore = (string)match.Attribute("homeTeamScore"),
AwayScore = (string)match.Attribute("awayTeamScore"),
GoalsPlayer = (string)match.Attribute("playerName"),
GoalsTime = (string)match.Attribute("time"),
};
}
catch (Exception ex)
{
Debug.WriteLine(ex.StackTrace);
}
here is my XAML
<ListBox Name="listBox2" Grid.Row="0">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Name="teams" Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="0,10,0,0" Foreground="White" HorizontalAlignment="Left" Text="{Binding HomeTeam}"/>
<TextBlock Margin="10,10,30,0" Foreground="White" Text="{Binding HomeScore}" TextWrapping="Wrap" FontSize="20" />
<TextBlock Margin="0,10,0,0" Foreground="White" HorizontalAlignment="Left" Text="{Binding AwayTeam}"/>
<TextBlock Margin="10,10,30,0" Foreground="White" Text="{Binding AwayScore}" TextWrapping="Wrap" FontSize="20" />
</StackPanel>
<StackPanel Name="scores" Orientation="Horizontal">
<TextBlock Margin="0,10,0,0" Foreground="White" Text="{Binding GoalsPlayer}" TextWrapping="Wrap" FontSize="20" />
<TextBlock Margin="10,10,30,0" Foreground="White" Text="{Binding GoalsTime}" TextWrapping="Wrap" FontSize="20" />
</StackPanel>
<StackPanel Name="dismissals">
<TextBlock Foreground="White" Text="{Binding DismissalsPlayer}" TextWrapping="Wrap" FontSize="20"/>
<TextBlock Foreground="White" Text="{Binding DismissalsTime}" TextWrapping="Wrap" FontSize="20"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
here is my XML
<match homeTeam="Arsenal" awayTeam="Liverpool" homeTeamScore="0" awayTeamScore="2">
<goal time="77:13" playerName="Aaron Ramsey" />
<goal time="89:57" playerName="Luis Suarez"/>
<dismissal time="69:59" playerName="Emmanuel Frimpong"/>
</match>
I understand that I will only get one entry on my Page for Goals, which would be the first goal element in my XML
how can I go about that and implement every
<goal ...>
<goal ...>
into my Datatemplate that currently only shows the first entry, another potential problem is I cannot guarantee how many goals there will be so I am a really unsure on how to go about it entirely
thanks
John
Should playerName even resolve on your match? Because that's where you are resolving it in your XML query.
Regardless, what you are looking for here is a sub-object that can be held in a list property of the Match object:
listBox2.ItemsSource = from item in element.Descendants("competition")
from match in item.Elements("match")
.Where(arg => arg.Attribute("awayTeam").Value == team ||
arg.Attribute("homeTeam").Value == team)
select new Match
{
HomeTeam = (string)match.Attribute("homeTeam"),
AwayTeam = (string)match.Attribute("awayTeam"),
HomeScore = (string)match.Attribute("homeTeamScore"),
AwayScore = (string)match.Attribute("awayTeamScore"),
Goals = match.Elements("goals").Select(ev => new MatchEvent
{
Player = (string)ev.Attribute("playerName"),
Time = (string)ev.Attribute("time")
}).ToList(),
Dismissals = match.Elements("dismissals").Select(ev => new MatchEvent
{
Player = (string)ev.Attribute("playerName"),
Time = (string)ev.Attribute("time")
}).ToList(),
};
And the updated XAML:
<ListBox Name="listBox2" Grid.Row="0">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Name="teams" Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="0,10,0,0" Foreground="White" HorizontalAlignment="Left" Text="{Binding HomeTeam}"/>
<TextBlock Margin="10,10,30,0" Foreground="White" Text="{Binding HomeScore}" TextWrapping="Wrap" FontSize="20" />
<TextBlock Margin="0,10,0,0" Foreground="White" HorizontalAlignment="Left" Text="{Binding AwayTeam}"/>
<TextBlock Margin="10,10,30,0" Foreground="White" Text="{Binding AwayScore}" TextWrapping="Wrap" FontSize="20" />
</StackPanel>
<ItemsControl ItemsSource="{Binding Goals}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Name="scores" Orientation="Horizontal">
<TextBlock Margin="0,10,0,0" Foreground="White" Text="{Binding Player}" TextWrapping="Wrap" FontSize="20" />
<TextBlock Margin="10,10,30,0" Foreground="White" Text="{Binding Time}" TextWrapping="Wrap" FontSize="20" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<ItemsControl ItemsSource="{Binding Dismissals}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Name="scores" Orientation="Horizontal">
<TextBlock Margin="0,10,0,0" Foreground="White" Text="{Binding Player}" TextWrapping="Wrap" FontSize="20" />
<TextBlock Margin="10,10,30,0" Foreground="White" Text="{Binding Time}" TextWrapping="Wrap" FontSize="20" />
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>