-4
我要刪除選定的堆棧面板,但是當我選擇的StackPanel它給予例外System.NullReferenceException的Windows Phone 8.1
<ListBox x:Name="listbox1" Background="{x:Null}"
Margin="-2,51,-4,647" BorderBrush="{x:Null}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Tag="{Binding Weight_ID}"
Tapped="StackPanel_Tapped" >
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="date" Text=" Date">
</TextBlock>
<TextBlock Text="{Binding Date_}" >
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
private void StackPanel_Tapped(object sender, TappedRoutedEventArgs e)
{
string id = (((e.OriginalSource) as TextBlock).Tag).ToString();
}
而你的問題是? http://stackoverflow.com/help/how-to-ask – Carlo
嘗試從ListBox替換爲ListVIew並使用ItemClick事件 –
非常感謝你 – frnendy