Skip to content

Instantly share code, notes, and snippets.

@rtanote
Created June 5, 2013 01:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtanote/5710890 to your computer and use it in GitHub Desktop.
Save rtanote/5710890 to your computer and use it in GitHub Desktop.
Livetを使ったファイル保存ダイアログの実装例
/* xaml
<Button Content="export" IsEnabled="{Binding ExportCommand.CanExecute}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<l:SaveFileDialogInteractionMessageAction>
<l:DirectInteractionMessage CallbackCommand="{Binding ExportCommand}">
<l:SavingFileSelectionMessage Filter="{Binding ExportFilter}" />
</l:DirectInteractionMessage>
</l:SaveFileDialogInteractionMessageAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
*/
/* view model */
public void Export(SavingFileSelectionMessage message) {
string filename = (message.Response != null) ? message.Response[0] : null;
if ( null != filename) {
logger.Debug(filename);
return;
}
}
private ListenerCommand<SavingFileSelectionMessage> _ExportCommand;
public ListenerCommand<SavingFileSelectionMessage> ExportCommand {
get {
if (_ExportCommand == null) {
_ExportCommand = new ListenerCommand<SavingFileSelectionMessage>(Export, CanExport);
}
return _ExportCommand;
}
}
public bool CanExport() {
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment