Adding CommandLinks through XAML

Dec 17, 2008 at 11:46 AM
Edited Dec 17, 2008 at 11:47 AM
Is it possible to add TaskDialogButtonData objects to a TaskDialog in XAML like this:

<av:TaskDialog>
    <av:TaskDialog.CommandLinks>
        <av:TaskDialogButtonData Value="1" Header="Yes, do it" />
        <av:TaskDialogButtonData Value="2" Header="No, thanks" IsDefault="True" />
    </av:TaskDialog.CommandLinks>
</av:TaskDialog>

This doesn't work since TaskDialogButtonData doesn't have a parameterless constructor. Is there any way to do it? I don't want to add CommandLinks through csharp code because of reasons like Localization, etc. (I am using x:Uid identifiers to localize my app)

Btw thanks for the great implementation!
Coordinator
Dec 18, 2008 at 8:04 AM
Hi Huseyin,

I'm sorry to say it's a scenario that slipped by me. You have a few options:
  • Download the code and add a parameterless constructor to TaskDialogButtonData.
  • Create your own class and use TaskDialog.CommandLinkContainerStyle to create a new DataTemplate for it.
  • Add a CommandLink directly to the CommandLinks collection.

I'd go for the first option. Anyhow, I'll fix this in the next release.

Aelij.
Coordinator
Dec 18, 2008 at 8:05 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.