Skip to content

Commit

Permalink
fix: Added MUX styles to run Samples on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Sep 11, 2020
1 parent e59acae commit 735ca30
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ public TreeViewSelectionMode SelectionMode
DependencyProperty.Register(nameof(ItemTemplateSelector), typeof(DataTemplateSelector), typeof(TreeView), new PropertyMetadata(null));

public static readonly DependencyProperty SelectionModeProperty =
DependencyProperty.Register(nameof(SelectionMode), typeof(TreeViewSelectionMode), typeof(TreeView), new PropertyMetadata(TreeViewSelectionMode.Single))
DependencyProperty.Register(nameof(SelectionMode), typeof(TreeViewSelectionMode), typeof(TreeView), new PropertyMetadata(TreeViewSelectionMode.Single));
}
}
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Controls/TreeView/TreeViewItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Windows.UI.Xaml.Controls
{
public partial class TreeViewItem
public partial class TreeViewItem : ListViewItem
{
private const long c_dragOverInterval = 1000 * 10000;
private const string c_multiSelectCheckBoxName = "MultiSelectCheckBox";
Expand Down
55 changes: 33 additions & 22 deletions src/Uno.UI/UI/Xaml/Controls/TreeView/TreeViewViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,9 @@ private void Append(object value)

// Hook up events and save tokens
var tvnNewNode = newNode;
m_collectionChangedEventTokenVector.push_back(tvnNewNode.ChildrenChanged({ this, &ViewModel.TreeViewNodeVectorChanged }));
m_IsExpandedChangedEventTokenVector.push_back(tvnNewNode.AddExpandedChanged({ this, &ViewModel.TreeViewNodePropertyChanged }));
//TODO
//m_collectionChangedEventTokenVector.push_back(tvnNewNode.ChildrenChanged({ this, &ViewModel.TreeViewNodeVectorChanged }));
//m_IsExpandedChangedEventTokenVector.push_back(tvnNewNode.AddExpandedChanged({ this, &ViewModel.TreeViewNodePropertyChanged }));
}

private void RemoveAtEnd()
Expand All @@ -177,12 +178,14 @@ private void RemoveAtEnd()

// unhook events
var tvnCurrent = current;
tvnCurrent.ChildrenChanged(m_collectionChangedEventTokenVector.back());
tvnCurrent.RemoveExpandedChanged(m_IsExpandedChangedEventTokenVector.back());
//TODO
//tvnCurrent.ChildrenChanged(m_collectionChangedEventTokenVector.back());
//tvnCurrent.RemoveExpandedChanged(m_IsExpandedChangedEventTokenVector.back());

// remove tokens
m_collectionChangedEventTokenVector.pop_back();
m_IsExpandedChangedEventTokenVector.pop_back();
//TODO
//m_collectionChangedEventTokenVector.pop_back();
//m_IsExpandedChangedEventTokenVector.pop_back();
}

private new void Clear()
Expand Down Expand Up @@ -216,11 +219,12 @@ internal void PrepareView(TreeViewNode originNode)
RemoveNodeAndDescendantsFromView(removeNode);
}

if (m_rootNodeChildrenChangedEventToken.value != 0)
{
var childrenVector = (ObservableVector<TreeViewNode>)existingOriginNode.Children;
childrenVector.VectorChanged(m_rootNodeChildrenChangedEventToken);
}
//TODO
//if (m_rootNodeChildrenChangedEventToken.value != 0)
//{
// var childrenVector = (ObservableVector<TreeViewNode>)existingOriginNode.Children;
// childrenVector.VectorChanged(m_rootNodeChildrenChangedEventToken);
//}
}

// // Add new RootNode & children
Expand Down Expand Up @@ -429,7 +433,8 @@ private void UpdateNodeSelection(TreeViewNode selectNode, TreeNodeSelectionState
{
case TreeNodeSelectionState.Selected:
selectedNodes.InsertAtCore(selectedNodes.Count, selectNode);
m_selectedNodeChildrenChangedEventTokenVector.push_back(get_self<TreeViewNode>(selectNode).ChildrenChanged({ this, &ViewModel.SelectedNodeChildrenChanged }));
//TODO
//m_selectedNodeChildrenChangedEventTokenVector.push_back(get_self<TreeViewNode>(selectNode).ChildrenChanged({ this, &ViewModel.SelectedNodeChildrenChanged }));
break;

case TreeNodeSelectionState.PartialSelected:
Expand All @@ -438,8 +443,9 @@ private void UpdateNodeSelection(TreeViewNode selectNode, TreeNodeSelectionState
if (index > -1)
{
selectedNodes.RemoveAtCore(index);
selectNode.ChildrenChanged(m_selectedNodeChildrenChangedEventTokenVector[index]);
m_selectedNodeChildrenChangedEventTokenVector.erase(m_selectedNodeChildrenChangedEventTokenVector.begin() + index);
//TODO
//selectNode.ChildrenChanged(m_selectedNodeChildrenChangedEventTokenVector[index]);
//m_selectedNodeChildrenChangedEventTokenVector.erase(m_selectedNodeChildrenChangedEventTokenVector.begin() + index);
}
break;
}
Expand Down Expand Up @@ -701,7 +707,8 @@ private void SelectedNodeChildrenChanged(TreeViewNode sender, object args)
if (ancestorNode != m_originNode)
{
selectedNodes.RemoveAtCore(i);
m_selectedNodeChildrenChangedEventTokenVector.erase(m_selectedNodeChildrenChangedEventTokenVector.begin() + i);
//TODO
//m_selectedNodeChildrenChangedEventTokenVector.erase(m_selectedNodeChildrenChangedEventTokenVector.begin() + i);
}
}
break;
Expand Down Expand Up @@ -732,7 +739,8 @@ private void SelectedNodeChildrenChanged(TreeViewNode sender, object args)
if (ancestorNode != m_originNode)
{
selectedNodes.RemoveAtCore(i);
m_selectedNodeChildrenChangedEventTokenVector.erase(m_selectedNodeChildrenChangedEventTokenVector.begin() + i);
//TODO
//m_selectedNodeChildrenChangedEventTokenVector.erase(m_selectedNodeChildrenChangedEventTokenVector.begin() + i);
}
}
break;
Expand Down Expand Up @@ -816,8 +824,9 @@ private void ClearEventTokenVectors()
{
var current = inner[i];
var tvnCurrent = (TreeViewNode)current;
tvnCurrent.ChildrenChanged(m_collectionChangedEventTokenVector.at(i));
tvnCurrent.RemoveExpandedChanged(m_IsExpandedChangedEventTokenVector.at(i));
//TODO
//tvnCurrent.ChildrenChanged(m_collectionChangedEventTokenVector.at(i));
//tvnCurrent.RemoveExpandedChanged(m_IsExpandedChangedEventTokenVector.at(i));
}
}

Expand All @@ -831,15 +840,17 @@ private void ClearEventTokenVectors()
if (current != null)
{
var node = (TreeViewNode)current;
node.ChildrenChanged(m_selectedNodeChildrenChangedEventTokenVector[i]);
//TODO
//node.ChildrenChanged(m_selectedNodeChildrenChangedEventTokenVector[i]);
}
}
}

// Clear token vectors
m_collectionChangedEventTokenVector.clear();
m_IsExpandedChangedEventTokenVector.clear();
m_selectedNodeChildrenChangedEventTokenVector.clear();
//TODO
//m_collectionChangedEventTokenVector.clear();
//m_IsExpandedChangedEventTokenVector.clear();
//m_selectedNodeChildrenChangedEventTokenVector.clear();
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
<SolidColorBrush x:Key="TreeViewItemCheckGlyphSelected" Color="{ThemeResource SystemColorWindowTextColor}" />
<Thickness x:Key="TreeViewItemBorderThemeThickness">1</Thickness>
<x:Double x:Key="TreeViewItemMinHeight">32</x:Double>
</ResourceDictionary>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

</ResourceDictionary>
1 change: 0 additions & 1 deletion src/Uno.UI/UI/Xaml/Style/Generic/SystemResources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3935,7 +3935,6 @@
<x:Double x:Key="DatePickerFlyoutPresenterAcceptDismissHostGridHeight">41</x:Double>
<x:Double x:Key="DatePickerFlyoutPresenterItemHeight">40</x:Double>

<x:Double x:Key="TreeViewItemMinHeight">32</x:Double>
<x:Double x:Key="TreeViewItemContentHeight">32</x:Double>
<x:Double x:Key="SliderPreContentMargin">15</x:Double>
<x:Double x:Key="SliderPostContentMargin">15</x:Double>
Expand Down

0 comments on commit 735ca30

Please sign in to comment.