Tree MenuItem hot fix
This commit is contained in:
@@ -85,6 +85,20 @@
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Delete.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Tree"
|
||||
Command="{Binding TreeCommand}"
|
||||
CommandParameter="{Binding ElementName=FunctionTreeView}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Tree.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="Rename"
|
||||
Command="{Binding RenameCommand}"
|
||||
CommandParameter="{Binding ElementName=FunctionTreeView}">
|
||||
<MenuItem.Icon>
|
||||
<Image Width="16" Height="16" Source="/Windows/MainWindow/Edit.png" />
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
</ContextMenu>
|
||||
</TreeView.ContextMenu>
|
||||
</TreeView>
|
||||
@@ -136,7 +150,8 @@
|
||||
</Grid.RowDefinitions>
|
||||
<Button Grid.Column="0" Margin="5" Content="Tree"
|
||||
Background="AntiqueWhite"
|
||||
Command="{Binding TreeCommand}"/>
|
||||
Command="{Binding TreeCommand}"
|
||||
CommandParameter="{Binding ElementName=FunctionTreeView}"/>
|
||||
<Button Grid.Column="1" Margin="5" Content="Rename"
|
||||
FontSize="10"
|
||||
Background="HotPink"
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace StructureHelper.Windows.TreeGraph
|
||||
}
|
||||
public ICommand TreeCommand
|
||||
{
|
||||
get => _treeCommand ??= new RelayCommand(o => NewTree());
|
||||
get => _treeCommand ??= new RelayCommand(o => NewTree(o));
|
||||
}
|
||||
public ICommand RenameCommand
|
||||
{
|
||||
@@ -276,9 +276,15 @@ namespace StructureHelper.Windows.TreeGraph
|
||||
}
|
||||
Save();
|
||||
}
|
||||
private void NewTree()
|
||||
private void NewTree(object parameter)
|
||||
{
|
||||
if (SelectedFuntion is null)
|
||||
var selectedTreeViewItem = TreeGraphView_win.FunctionTreeView.SelectedItem as TreeViewItemViewModel;
|
||||
if (selectedTreeViewItem is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
var selectedTreeViewItemParent = selectedTreeViewItem.Parent;
|
||||
if (selectedTreeViewItemParent is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user