Created
June 5, 2013 01:01
-
-
Save rtanote/5710890 to your computer and use it in GitHub Desktop.
Livetを使ったファイル保存ダイアログの実装例
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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