1
被搞亂了,似乎無法弄清楚。似乎對象發件人實際上是ListView ..所以即使如果我找出如何獲得GridViewColumn作爲一個孩子......我不知道如何區分哪個列實際點擊?GridViewColumnHeader.Click,如何檢測哪個列被點擊?
<ListView x:Name="SingleTweet_ListView"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
MouseLeftButtonUp="SingleTweet_ListView_MouseLeftButtonUp"
Height="200" Margin="5,5,5,5" FontSize="12"
GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler">
<ListView.View>
<GridView>
<GridViewColumn Header="Screen Name"
DisplayMemberBinding="{Binding Col1}" Width="112"/>
<GridViewColumn Header="Tweet"
DisplayMemberBinding="{Binding Col2}" Width="623"/>
</GridView>
</ListView.View>
</ListView>
void GridViewColumnHeaderClickedHandler(object sender, RoutedEventArgs e)
{
MessageBox.Show(((GridViewColumn)sender).Header.ToString());
//error cus the sender is actually the listview?
}
謝謝!完美地工作。我必須等8分鐘才能給你答案 – user1189352
啊謝謝你的編輯,有解釋而不是隻是一個代碼有助於理解,謝謝! – user1189352
不客氣.. !! :) –