Commit bfd9aa95 by liulongfei

聚焦逻辑

parent 05727698
......@@ -21,7 +21,6 @@ namespace VIZ.Package.Module
public ListCellEditBase()
{
this.DataContextChanged += CellEditBase_DataContextChanged;
this.PreviewMouseLeftButtonDown += ListCellEditBase_PreviewMouseLeftButtonDown;
}
/// <summary>
......@@ -67,29 +66,6 @@ namespace VIZ.Package.Module
}
/// <summary>
/// 鼠标点击时触发
/// </summary>
private void ListCellEditBase_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
DevExpress.Xpf.Grid.EditGridCellData cellData = this.DataContext as DevExpress.Xpf.Grid.EditGridCellData;
if (cellData == null)
return;
GridColumnDefinition columnDefinition = cellData.Column.DataContext as GridColumnDefinition;
if (columnDefinition == null)
return;
ControlListFieldChangedMessage msg = new ControlListFieldChangedMessage();
msg.ControlObject = columnDefinition.ControlObject;
msg.ControlField = columnDefinition.ControlField;
msg.Object = cellData.Row;
msg.ListLine = cellData.RowData.RowHandle.Value;
msg.FieldIdentifier = columnDefinition.FieldName;
ApplicationDomainEx.MessageManager.Send(msg);
}
/// <summary>
/// 更新
/// </summary>
/// <param name="columnDefinition">列定义</param>
......
......@@ -103,16 +103,21 @@
</UserControl.Resources>
<Grid>
<dxg:GridControl x:Name="grid" ItemsSource="{Binding Path=ItemsSource}" ShowBorder="False" Grid.Column="1" AllowDrop="True"
ColumnsSource="{Binding Path=Columns}"
<dxg:GridControl ItemsSource="{Binding Path=ItemsSource}" ShowBorder="False" Grid.Column="1" AllowDrop="True"
ColumnsSource="{Binding Path=Columns}" SelectionMode="Cell"
ColumnGeneratorTemplate="{StaticResource ColumnTemplate}">
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="SelectionChanged" PassEventArgsToCommand="True" Command="{Binding Path=SelectionChangedCommand}"></dxmvvm:EventToCommand>
</dxmvvm:Interaction.Behaviors>
<dxg:GridControl.ContextMenu>
<ContextMenu>
<MenuItem Header="刷新" Command="{Binding Path=PlacementTarget.DataContext.RefreshControlObjectFieldListCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ContextMenu}}"/>
</ContextMenu>
</dxg:GridControl.ContextMenu>
<dxg:GridControl.View>
<dxg:TableView AllowEditing="True" ShowIndicator="True"
<dxg:TableView x:Name="tabView" AllowEditing="True" ShowIndicator="True"
IsColumnMenuEnabled="False"
NavigationStyle="Cell" EditorShowMode="MouseDown"
ShowGroupPanel="False"
......
using System;
using DevExpress.Xpf.Grid;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VIZ.Framework.Core;
using VIZ.Package.Domain;
using VIZ.Package.Service;
......@@ -14,6 +16,20 @@ namespace VIZ.Package.Module
/// </summary>
public class ListEditPanelModel : EditPanelModelBase
{
public ListEditPanelModel()
{
// 初始化命令
this.InitCommand();
}
/// <summary>
/// 初始化命令
/// </summary>
private void InitCommand()
{
this.SelectionChangedCommand = new VCommand<DevExpress.Xpf.Grid.GridSelectionChangedEventArgs>(this.SelectionChanged);
}
// ===================================================================
// Service & Controller
// ===================================================================
......@@ -55,6 +71,48 @@ namespace VIZ.Package.Module
#endregion
// ===================================================================
// Command
// ===================================================================
/// <summary>
/// 选择改变命令
/// </summary>
public VCommand<DevExpress.Xpf.Grid.GridSelectionChangedEventArgs> SelectionChangedCommand { get; set; }
/// <summary>
/// 选择改变
/// </summary>
private void SelectionChanged(DevExpress.Xpf.Grid.GridSelectionChangedEventArgs e)
{
ListEditPanel view = this.GetView<ListEditPanel>();
if (view == null)
return;
IList<GridCell> cells = view.tabView.GetSelectedCells();
if (cells == null || cells.Count == 0)
return;
GridCell cell = cells.FirstOrDefault();
GridColumnDefinition columnDefinition = cell.Column.DataContext as GridColumnDefinition;
if (columnDefinition == null)
return;
ControlListFieldChangedMessage msg = new ControlListFieldChangedMessage();
msg.ControlObject = columnDefinition.ControlObject;
msg.ControlField = columnDefinition.ControlField;
msg.Object = cell.Row;
msg.ListLine = cell.RowHandle;
msg.FieldIdentifier = columnDefinition.FieldName;
ApplicationDomainEx.MessageManager.Send(msg);
}
// ===================================================================
// Public Function
// ===================================================================
/// <summary>
/// 更新
/// </summary>
......
......@@ -395,11 +395,11 @@ namespace VIZ.Package.Service
if (config.EngineFullType == EngineFullType.VIZ_Eng3)
{
conn.EndpointManager.Send($"RENDERER*TREE*{obj.TreeNodePath}*FUNCTION*ControlObject*in SET WITH LIST INDEX {listLine} FOCUS {fieldIdentifier}");
conn.EndpointManager.Send($"RENDERER*TREE*{obj.TreeNodePath}*FUNCTION*ControlObject*in SET WITH {field.FieldIdentifier} INDEX {listLine} FOCUS {fieldIdentifier}");
}
else if (config.EngineFullType == EngineFullType.VIZ_Eng4)
{
conn.EndpointManager.Send($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*{obj.TreeNodePath}*FUNCTION*ControlObject*in SET WITH LIST INDEX {listLine} FOCUS {fieldIdentifier}");
conn.EndpointManager.Send($"{ApplicationDomainEx.VizPreviewRenderer}*TREE*{obj.TreeNodePath}*FUNCTION*ControlObject*in SET WITH {field.FieldIdentifier} INDEX {listLine} FOCUS {fieldIdentifier}");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment