C# windowsPhone 8:在stackpanel中向listview.Template添加json数据,而不使用modal
我想通过使用C#代码而不使用模式将json数据添加到listview项内的stackpanel(名称:expand)中。。。 我已经解析了json数据……但我不知道如何在不使用modal的情况下将其附加到stackpanel中名为“Expand”的listview项 这是我的XAMLC# windowsPhone 8:在stackpanel中向listview.Template添加json数据,而不使用modal,c#,xaml,windows-phone-8,windows-phone-8.1,C#,Xaml,Windows Phone 8,Windows Phone 8.1,我想通过使用C#代码而不使用模式将json数据添加到listview项内的stackpanel(名称:expand)中。。。 我已经解析了json数据……但我不知道如何在不使用modal的情况下将其附加到stackpanel中名为“Expand”的listview项 这是我的XAML <ListView.Items> </ListView.Items> <Lis
<ListView.Items>
</ListView.Items>
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Border Tapped="Border_Tap" Height="90">
<StackPanel x:Name="ParentStackPanel" Width="380" Margin="0,5,0,5">
<StackPanel Background="Black" Margin="60,-80,0,0" Grid.Row="0" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left">
<TextBlock Text="{Binding CompanyName1}" FontSize="20" FontStyle="Normal">
</TextBlock>
</StackPanel>
<StackPanel DataContext="expand1" Name="expand" Background="White" Height="220">
</StackPanel>
</Border>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
感谢为您的json获取类,它非常方便:
public class Invoice
{
public string TF { get; set; }
public string BF { get; set; }
public string MD { get; set; }
public string EFM { get; set; }
public string ATT { get; set; }
public string FPK { get; set; }
}
public class Example
{
public Invoice Invoice { get; set; }
public string TF { get; set; }
}
public class RootObject
{
public List<Example> Example { get; set; }
}
让我知道它是否有效 您已经使用了modal…我希望不使用modaltry进行动态反序列化,或者对对象进行反序列化
public class Invoice
{
public string TF { get; set; }
public string BF { get; set; }
public string MD { get; set; }
public string EFM { get; set; }
public string ATT { get; set; }
public string FPK { get; set; }
}
public class Example
{
public Invoice Invoice { get; set; }
public string TF { get; set; }
}
public class RootObject
{
public List<Example> Example { get; set; }
}
var objects = JsonConvert.DeserializeObject<RootObject>(jsonString);
public class Invoice
{
[Newtonsoft.Json.JsonProperty(PropertyName = "CompanyName1")]
public string TF { get; set; }
[Newtonsoft.Json.JsonProperty(PropertyName = "ComapnyName2")]
public string BF { get; set; }
}