Exemplo n.º 1
0
 private void Control2_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (sender is DiffDataGridControl gridControl)
     {
         this.Dispatcher.InvokeAsync(() =>
         {
             if (e.PropertyName == nameof(this.GridControl2.GlobalCurrentItem))
             {
                 var gridContext = DataGridControl.GetDataGridContext(this.GridControl2);
                 var items       = DiffItemInfo.GetVisibleItems(gridContext);
                 var index       = items.IndexOf(i => i.Item == this.GridControl2.GlobalCurrentItem);
                 if (index == -1)
                 {
                     this.SetValue(LinePositionVisibility2PropertyKey, Visibility.Hidden);
                 }
                 else
                 {
                     var s = (1.0 / (double)(items.Count()));
                     this.SetValue(LinePositionVisibility2PropertyKey, Visibility.Visible);
                     this.SetValue(LinePosition2PropertyKey, s * index + s * 0.5);
                 }
             }
         });
     }
 }
Exemplo n.º 2
0
        public static               DiffMinimapItemInfo[] CollectMinimapItems(DataGridContext gridContext)
        {
            var itemInfoList = new List <DiffMinimapItemInfo>();
            var itemInfo     = new DiffMinimapItemInfo();

            var items = DiffItemInfo.GetVisibleItems(gridContext);

            foreach (var item in items)
            {
                TestMinimapItem(item.Item, item.GridContext, itemInfoList, ref itemInfo);
            }
            if (itemInfo.Count != 0)
            {
                itemInfoList.Add(itemInfo);
            }

            return(itemInfoList.ToArray());
        }