롤러 덕분에 복싱, 팀 이름 및 통계와 같은 정보를 얻을 수있는 앱을 만들고 있습니다. 정보는 JSON 형식으로 저장됩니다. 결국 데이터를 가져 와서 이와 비슷한 형식으로 정렬하려고합니다. Team1 Team2 Venue Date Result. 행의 양은 각 복싱 목록의 길이 여야합니다. C# 코드에서이 작업을 수행하는 방법을 찾는 데 어려움이 있습니다. 누구든지 올바른 방향으로 나를 가리킬 수 있습니다. 나는이 오류 메시지가 프로그램을 실행할 때 나는 목록 상자를 구현하려고하고 내가 여기에있는 튜토리얼을 따라하려고 http://msdn.microsoft.com/en-us/library/cc265158%28v=vs.95%29.aspx윈도우 7 플랫폼을 사용하여 행과 열로 동적 테이블을 만드는 방법
:
편집 오류 1 이벤트 핸들러 'PhoneApplicationPage_Loaded를'클래스를 찾을 수 없습니다 'PhoneApp2.Page1'C : \ 사용자는 루이스 \ 문서 \ 비주얼 스튜디오 2010 \ 프로젝트 \ \ PhoneApp2 \ PhoneApp2 \ Page1.xaml 롤러 더비 앱 여기
내 XAML은 PAGE1
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Upcoming Bouts" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" Width="297" TextWrapping="NoWrap" FontSize="40" HorizontalAlignment="Left" />
<Button Name="Home" Content="Home" Width="310" HorizontalContentAlignment="Center" HorizontalAlignment="Left" Click="Home_Click" />
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<ListBox Height="100" HorizontalAlignment="Left" Margin="544,177,0,0" Name="ListofBouts" VerticalAlignment="Top" Width="460" Loaded="ListofBouts_Loaded">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Padding="5,0,5,0"
Text="{Binding Venue}" />
<TextBlock Text="{Binding Team1}" />
<TextBlock Text="{Binding Team2}"/>
<TextBlock Text="{Binding Date}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
<!--Sample code showing usage of ApplicationBar-->
<!--<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
<shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>-->
입니다 여기
는 오류 이벤트가 Page1
의 Loaded
이벤트를 정의가 있다고 말하고있다 C#
namespace PhoneApp2
{
public partial class Page1 : PhoneApplicationPage
{
public Page1()
{
InitializeComponent();
}
private void Home_Click(object sender, RoutedEventArgs e)
{
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
}
private void ListofBouts_Loaded(object sender, RoutedEventArgs e)
{
InitializeComponent();
}
public class Bouts
{
public string Venue { get; set; }
public string Team1 { get; set; }
public string Team2 { get; set; }
public string Date { get; set; }
public Bouts(String venue, String team1, String team2, String date)
{
this.Venue = venue;
this.Team1 = team1;
this.Team2 = team2;
this.Date = date;
}
}
public class bouts : ObservableCollection<Bouts>
{
public bouts()
{
Add(new Bouts("Yankee Sadium", "Yankees", "Mets", "March 3"));
Add(new Bouts("Yankee Sadium", "Yankees", "Mets", "March 3"));
Add(new Bouts("Yankee Sadium", "Yankees", "Mets", "March 3"));
Add(new Bouts("Yankee Sadium", "Yankees", "Mets", "March 3"));
}
}
}
}
역 직렬화를 사용합니까? 마찬가지로 여기에 발견 : http://stackoverflow.com/questions/1207731/how-can-i-deserialize-json-to-a-simple-dictarystring-string-in-asp-net –
링크를 주셔서 감사합니다. 도움이됩니다. 그러나 실제로는 더미 그래프를 Listbox에 넣기를 원합니다. 오류 메시지가 나타납니다. 오류 이벤트 처리기 'PhoneApplicationPage_Loaded' 'PhoneApp2.Page1'\t c : \ users \ lewis \ documents \ visual 스튜디오 2010 \ Projects \ PhoneApp2 \ PhoneApp2 \ Page1 클래스에서 찾을 수 없습니다. xaml \t 롤러 더비 앱 –