C# Caliburn导出触发器值为空
所以我在我的xaml页面上实现了一个触发器来指向我的导出函数。但它传递的是一个空值,而不是网格值。如果我能得到帮助,请 xaml.csC# Caliburn导出触发器值为空,c#,xaml,C#,Xaml,所以我在我的xaml页面上实现了一个触发器来指向我的导出函数。但它传递的是一个空值,而不是网格值。如果我能得到帮助,请 xaml.cs <Button Content="Spreadsheet Export" Style="{StaticResource ActionButtonStyle}"> <i:Interaction.Triggers> <i:EventTrigger EventName="Click">
<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">
public void导出(RadGridView网格)
{
var dialog=new SaveFileDialog()
{
DefaultExt=“xls”,FilterIndex=1,
Filter=“Excel文件(*.xls)|*.xls |所有文件|*.*”,
};
if(!(bool)dialog.ShowDialog())返回;
使用(var stream=dialog.OpenFile())
{
Export(流,新的GridViewExportOptions()
{
Format=ExportFormat.ExcelML,ShowColumnHeaders=true,
ShowColumnFooters=true,ShowGroupFooters=false,
});
}
}
同一Xaml.cs文件中的所有Xaml代码能否显示名为“Grid”的元素及其与按钮的关系,即它们是否位于同一面板中?相同的用户控制?已更新,如果您还需要其他信息,请告诉我。我对此感到相当困惑。