我真的搞砸了在 WPF Telerik RadRichtextbox 中填充数据,我从名为“LetterServiceClient”的 WCF 服务获取数据集,现在想要在“邮件”->“插入合并字段”下拉列表中填充数据,但未能这样做. 为了您的参考,我还附上了一个屏幕截图,让您清楚地看到。
主窗口.xaml
<telerik:RadRibbonDropDownButton
x:Name="ddinsert"
Content=""
CollapseToMedium="WhenGroupIsMedium"
LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/InsertMergeField.png"
telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding InsertMergeFieldEmptyCommand}"
Size="Large"
Text="Insert Merge Field"
telerik:ScreenTip.Title="Insert Merge Field"
/>
主窗口.cs
private void bindData()
{
ServiceReference1.LetterServiceClient letterservice = new ServiceReference1.LetterServiceClient();
DataSet ds = letterservice.ExecuteTagSchema("SearchPatient");
List<string> listTemp = new List<string>();
int i = 0;
foreach (DataColumn item in ds.Tables[0].Columns)
{
listTemp.Add(item.ColumnName);
}
this.ddinsert.DataContext = listTemp.ToArray();
//this.radRichTextBox.Document.MailMergeDataSource.ItemsSource = listTemp.ToArray();
//this.radRichTextBox.Document.MailMergeDataSource.ItemsSource= listTemp.ToArray();
}