0
在Web窗體中Repeater有一個事件OnItemDataBound。
Windows Phone應用程序中的ListBox是否有類似的事件?
我試圖開發聊天(消息)的東西,我需要調整StackPanels在不同的側面。
任何想法?Windows phone ListBox是否具有asp:Repeater的OnItemDataBound類似事件?
的XAML
<ListBox Name="TicketReplyListBox" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Background="Blue" MaxHeight="200" Width="400" HorizontalAlignment="Left">
<TextBlock Text="{Binding ContentText}"
FontSize="18"
FontFamily="\Resources\Fonts\sylfaen.ttf#sylfaen"
FontWeight="Bold"
TextWrapping="Wrap"
Margin="6,12,6,6"
HorizontalAlignment="Left"
VerticalAlignment="Top" />
<TextBlock Text="{Binding Date}"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Margin="6,0,6,6"
FontSize="18"
FontFamily="Segoe WP SemiLight" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
代碼:
public class TicketReplyModel
{
public int TicketID { get; set; }
public string ContentText { get; set; }
public bool IsClient { get; set; }
public DateTime Date { get; set; }
}
Service1Client WCFClient = new ServiceReference1.Service1Client();
public ActiveTicketDetail()
{
InitializeComponent();
WCFClient.GetTicketReplyListCompleted += new EventHandler<GetTicketReplyListCompletedEventArgs>(WCFClient_GetTicketReplyListCompleted);
WCFClient.GetTicketReplyListAsync(84);
}
void WCFClient_GetTicketReplyListCompleted(object sender, GetTicketReplyListCompletedEventArgs e)
{
List<TicketReplyModel> TickteReptyList = new List<TicketReplyModel>();
TickteReptyList = e.Result.ToList();
TicketReplyListBox.ItemsSource = TickteReptyList;
}
而且在每次迭代我想根據IsClient
沒有,按我的知識,請詳細說明這個問題,以便我們能夠找到解決問題的一種替代 –