Dynamic ValidateSet

Product: PowerShell Universal
Version: 3.2.8

Looking to create a custom ValidateSet basic on the contents of an xml. This is so when users run a Script they are presented with a pre-filled dropdown of the only available choices.
I have tried a few approches but cannot get the ValidateSet to dynamically fill.

I have currently created a Module with a function that does the action.
When I let it run the function returs the results I want. Is this pssible and any ideas on how to do this?

Param(
    [string[]]
    [ValidateSet({Get-PartnerTenants})]
    $Tenant
 )

 Get-PartnerTenants

function;

function Get-PartnerTenants {
    return $(Import-Clixml -Path $Repository\bin\Office365\PartnerTenants.xml).displayName
}

This works, kinda I guess…

function Get-TheTenantThings {
    [CmdletBinding()]
    param (
    [Parameter(Mandatory)]
    [ValidateScript(
        { $_ -in (Import-Clixml -Path $Repository\bin\Office365\PartnerTenants.xml).displayName }
    )]
    [String]$Tenant
    )

    write-host "the -Tenant param you passed ($Tenant) is valid"
}

or you can split it out into another function…

function Get-PartnerTenants {
    return (Import-Clixml -Path $Repository\bin\Office365\PartnerTenants.xml).displayName
}

function Get-TheTenantThings {
    [CmdletBinding()]
    param (
    [Parameter(Mandatory)]
    [ValidateScript(
        { $_ -in $(Get-PartnerTenants) }
    )]
    [String]$Tenant
    )

    write-host "the -Tenant param you passed ($Tenant) is valid"
}

Thanks, I’ll see if that works.
It was specifically for running a script and having the user generated dropdown populated.

Thanks, but that unfortunately doesn’t work for ValidateSet in PSU Scripts for creating a dropdown.