Rather than adding a TakeUntil(control.StyleDetach) to each applied
style, keep track of the applied styles in a static list. This
dramatically reduces memory usage.
This is needed so that things like the following can be done:
<TreeView>
<TreeView.Styles>
<Style Selector="TreeViewItem">
<Setter Property="IsExpanded" Value="{Binding IsExpanded}"/>
</Style>
</TreeView.Styles>
<TreeView>
(At the moment we have TreeDataTemplate.IsExpanded but this isn't good
enough: it only supports setting IsExpanded on creation of the item with
no binding.)
With this commit, setters can now contain bindings, but they aren't yet
applied correctly. As part of this commit, classes related to binding
have been moved to the Perspex.Data namespace.
Most controls want to be styled based on their type, however windows
derived from Window will usually want to be styled as Window. Added an
IStyleable.StyleKey property to select the type that a control is styled
on.