In a script we can call mylist = forms.SelectFromList(list, etcetc)
I’ve changed the xaml file the class SelectFromList loads. So xaml_source is still ‘SelectFromList.xaml’ but I’ve editted the original (%appdata%/pyRevit-Master etcetc).
I’m not the greatest fan changing originals (reinstall = everything gone).
So I’d rather have that custom SelectFromList.xaml in my .extension / lib folder for example. Cleaner and better to manage.
this doesn’t work, but you get the idea. I need to point to my custom xaml somehow. mylist = forms.SelectFromList(customxaml, list, etcetc)
Unfortunately, while the base class WPFWindow lets (well, needs) you to specify the xaml file in the constructor, the classes that inherit from TemplateUserInputWindow, such as SelectFromList, have this parameter hardcoded in them as a class (not instance) attribute.
To workaround this, you can create a class that inherits from SelectFromList and override the xaml that it loads, then use your class when you need it.
from pyrevit.forms import SelectFormList
class MyListSelector(SelectFormList):
xaml_source = "my_custom_window.xaml"
Oh! I didn’t know you can overwrite class variables like that.
The xaml isn’t selected for me though. Since XAML_FILES_DIR is hardcoded too in init I assume my alternative xaml file should be in the same directory as the current SelectFromList.xaml.
So for now I put in pyrevit > forms my file SelectFromList_Faster.xaml
Xaml_files_dir can’t be overwritten as it is not in a class right?