Forum Discussion
Dynamic Dropdown Properties in Power BI Custom Visuals
In Power BI custom visuals, the capabilities.json file is static, which means dropdowns and enumerations must usually be predefined at design time. When you define your fillPatterns property with an empty enumeration, the dropdown will not work unless you explicitly add static entries into the JSON. This limitation makes it tricky when you want the property values to be dynamic, such as generating a list of patterns or options based on the number of slices in your data. The settings pane (PatternSettings class) lets you structure groups and cards, but it still relies on the schema defined in capabilities.json. Since capabilities.json cannot change at runtime, the usual workaround is to expose a generic property in the JSON (e.g., a text or enumeration placeholder) and then dynamically build the UI in your formatting model or programmatically update it via code when data changes. In short, the dropdown works only with static JSON entries, and true dynamic properties are not directly supported—so you have to use a hybrid approach of static JSON definitions combined with dynamically injected logic in the formatting settings code.