2012-05-27 62 views
0

我有以下XAML如何在ListBox的元素上應用一個函數?

<ListBox Name="feedListBox" Height="468" HorizontalAlignment="Left" Margin="20,100,0,0" VerticalAlignment="Top" Width="444" ScrollViewer.VerticalScrollBarVisibility="Auto" SelectionChanged="feedListBox_SelectionChanged" DataContext="{Binding Source={StaticResource MyData}}"> 
    <ListBox.ItemTemplate> 
     <DataTemplate> 
       <StackPanel VerticalAlignment="Top"> 
        <TextBlock TextDecorations="Underline" FontSize="24" Name="feedTitle" TextWrapping="Wrap" Margin="12,0,0,0" HorizontalAlignment="Left" Foreground="{StaticResource PhoneAccentBrush}" Text="{Binding Title.Text, Path=Arabic , Converter={StaticResource RssTextTrimmer}}" /> 
        <TextBlock Name="feedSummary" TextWrapping="Wrap" Margin="12,0,0,0" Text="{Binding Summary.Text, Converter={StaticResource RssTextTrimmer}}" /> 
        <TextBlock Name="feedPubDate" Foreground="{StaticResource PhoneSubtleBrush}" Margin="12,0,0,10" Text="{Binding PublishDate.DateTime}" /> 
       </StackPanel> 
     </DataTemplate> 
    </ListBox.ItemTemplate> 
</ListBox> 

現在我有這個對象

crAr = new Arabic.Controls.ArabicShape(); 

我想申請的DisplayArabic方法是這樣的XAML的每一個元素:

///// FeedTitle TextBlock 
{TextBlock ELEMENT content} = crAr.DisplayArabic({TextBlock ELEMENT content}); 

///// FeedSummary TextBlock 
{TextBlock ELEMENT content} = crAr.DisplayArabic({TextBlock ELEMENT content}); 

///// FeedPubDate TextBlock 
{TextBlock ELEMENT content} = crAr.DisplayArabic({TextBlock ELEMENT content}); 

如何這可以用C#編寫嗎?

回答

相關問題