Caliburn导出触发值为空

时间:2014-04-17 16:30:17

标签: c# xaml

所以我在xaml页面上实现了一个触发器,指向我的导出功能。但它传递的是空值而不是网格值。如果我能得到帮助,请

xaml.cs

<Button Content="Spreadsheet Export" Style="{StaticResource ActionButtonStyle}">
     <i:Interaction.Triggers>
           <i:EventTrigger EventName="Click">
               <cal:ActionMessage MethodName="Export">
                  <cal:Parameter Value="{Binding ElementName=Grid}" />
               </cal:ActionMessage>
            </i:EventTrigger>
     </i:Interaction.Triggers>
 </Button> 

导出功能:

public void Export(RadGridView grid)
{
    var dialog = new SaveFileDialog()
    {
        DefaultExt = "xls", FilterIndex = 1,
        Filter = "Excel files (*.xls)|*.xls|All files|*.*",
    };
    if (! (bool) dialog.ShowDialog()) return;
    using (var stream = dialog.OpenFile())
    {
        grid.Export(stream, new GridViewExportOptions()
        {
            Format = ExportFormat.ExcelML, ShowColumnHeaders = true,
            ShowColumnFooters = true, ShowGroupFooters = false,
        });
    }
 }

<telerik:RadGridView x:Name="Grid" ItemsSource="{Binding Items, IsAsync=True}" SelectedItem="{Binding SelectedItem}" ShowColumnFooters="True"> 

同一个xaml.cs文件中的所有Xaml代码

0 个答案:

没有答案