Теперь, если я перетащу GridSplitter вверх, сначала он достигнет предела минимума верхнего зрителя. , но если я продолжу перетаскивать вверх, GridSplitter не будет двигаться, но WPF считает, что размер нижнего средства просмотра прокрутки ДЕЙСТВИТЕЛЬНО увеличивается. Вплоть до того момента, когда нижний ScrollViewer станет достаточно большим, чтобы увидеть все содержимое и полностью удалить полосу прокрутки.
Вот xaml главного окна:
Код: Выделить всё
Код: Выделить всё
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows;
namespace GridSplitTest
{
public partial class MainWindow : Window, INotifyPropertyChanged
{
private List _texts = new List();
private double bottomRowHeight = 100;
public MainWindow()
{
InitializeComponent();
DataContext = this;
for (int i = 0; i < 100; i++)
{
_texts.Add(i.ToString());
}
}
public double BottomRowHeight
{
get => bottomRowHeight;
set
{
bottomRowHeight = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(BottomRowHeight)));
}
}
public List Texts => _texts;
public event PropertyChangedEventHandler PropertyChanged;
}
}
Код: Выделить всё
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Data;
namespace GridSplitTest
{
public class RowHeightConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return new GridLength((double)value);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
GridLength gridLength = (GridLength)value;
return gridLength.Value;
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/782 ... -the-conte