Sample Code Revit Batch Processor 1.1.11 documentation

Contents:

This Page

duHast.UI.Objects.WPF.ViewModels package

Submodules

duHast.UI.Objects.WPF.ViewModels.FilterItem module

A class to provide filtering of views of observable collections..

IsChecked property should be bound similar to this sample code: <GridViewColumn.HeaderContainerStyle>

<Style TargetType=”GridViewColumnHeader”>
<Setter Property=”ContextMenu”>
<Setter.Value>
<ContextMenu>
<ItemsControl ItemsSource=”{Binding UniqueFamilyNames}”>
<ItemsControl.ItemTemplate>
<DataTemplate>
<CheckBox

Content=”{Binding Value}” IsChecked=”{Binding IsChecked, Mode=TwoWay}” <<<— here Command=”{Binding CheckCommand}”/>

</DataTemplate>

</ItemsControl.ItemTemplate>

</ItemsControl>

</ContextMenu>

</Setter.Value>

</Setter>

</Style> </GridViewColumn.HeaderContainerStyle>

class duHast.UI.Objects.WPF.ViewModels.FilterItem.FilterItem(*args: Any, **kwargs: Any)

Bases: ViewModelBase

A filter item for a view model view.

Is used in column context menu filters to filter the view based on the value of the item.

Parameters:
  • value – the value of the item

  • refresh_view_method – the method to call to refresh the view

property Value

Gets the value of the item displayed in the context menu.

property IsChecked

Gets the is checked value of the item.

duHast.UI.Objects.WPF.ViewModels.MainViewModel module

A class to provide the main view model of a wpf window.

Based on:

https://www.youtube.com/channel/UC7X9mQ_XtTYWzr9Tf_NYcIg

class duHast.UI.Objects.WPF.ViewModels.MainViewModel.MainViewModel(*args: Any, **kwargs: Any)

Bases: ViewModelBase

A base class for WPF view models.

property CurrentViewModel
OnCurrentViewModelChanged()

duHast.UI.Objects.WPF.ViewModels.ViewModelBase module

A base class for WPF view models.

Based on:

https://markheath.net/post/wpf-and-mvvm-in-ironpython

class duHast.UI.Objects.WPF.ViewModels.ViewModelBase.ViewModelBase(*args: Any, **kwargs: Any)

Bases: INotifyPropertyChanged

A base class for WPF view models.

RaisePropertyChanged(propertyName)

Raises property changed event for handlers

Args:

propertyName (str): the name of the property which has changed

add_PropertyChanged(handler)

Adds a handler to the property changed event.

remove_PropertyChanged(handler)

Removes a handler from the property changed event.

Module contents