This commit is contained in:
@@ -207,7 +207,7 @@
|
||||
|
||||
<!-- 湿膜表格 -->
|
||||
<GroupBox Grid.Column="0" Header="💧 湿膜数据" Margin="0,0,5,0">
|
||||
<DataGrid ItemsSource="{Binding Record.DataPoints}"
|
||||
<DataGrid x:Name="dgWetData" ItemsSource="{Binding Record.DataPoints}"
|
||||
SelectedItem="{Binding SelectedDataPoint}"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
@@ -225,7 +225,7 @@
|
||||
|
||||
<!-- 干膜表格 -->
|
||||
<GroupBox Grid.Column="1" Header="🔥 干膜数据" Margin="5,0,0,0">
|
||||
<DataGrid ItemsSource="{Binding Record.DataPoints}"
|
||||
<DataGrid x:Name="dgDryData" ItemsSource="{Binding Record.DataPoints}"
|
||||
SelectedItem="{Binding SelectedDataPoint}"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
@@ -276,7 +276,7 @@
|
||||
<TextBlock Text="~" VerticalAlignment="Center" Margin="1"/>
|
||||
<TextBox Text="{Binding UpperPore}" Width="48" Margin="1"/>
|
||||
<TextBlock Text="μm" VerticalAlignment="Center" Margin="2,0,5,0"/>
|
||||
<Button Content="计算" Command="{Binding CalculateCommand}" Margin="2,0" Padding="8,5" Background="#2196F3"/>
|
||||
<Button Content="计算" Command="{Binding CalculateCommand}" Margin="2,0" Padding="8,5" Background="#2196F3" Click="Button_Click"/>
|
||||
<TextBlock Text="{Binding RangePercentage, StringFormat={}{0:F1}%}" FontSize="14" FontWeight="Bold" VerticalAlignment="Center" Margin="5,0" Foreground="#4CAF50"/>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MembranePoreTester.ViewModels;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace MembranePoreTester.Views
|
||||
@@ -23,6 +24,43 @@ namespace MembranePoreTester.Views
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.Loaded += OnLoaded;
|
||||
|
||||
}
|
||||
|
||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = this.DataContext as PoreDistributionViewModel;
|
||||
if (vm != null)
|
||||
{
|
||||
vm.Record.DataPoints.CollectionChanged += DataPoints_CollectionChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void DataPoints_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Add)
|
||||
{
|
||||
// 滚动湿膜表格到底部
|
||||
ScrollDataGridToEnd(dgWetData);
|
||||
// 滚动干膜表格到底部
|
||||
ScrollDataGridToEnd(dgDryData);
|
||||
}
|
||||
}
|
||||
|
||||
private void ScrollDataGridToEnd(DataGrid dataGrid)
|
||||
{
|
||||
if (dataGrid.Items.Count > 0)
|
||||
{
|
||||
dataGrid.ScrollIntoView(dataGrid.Items[dataGrid.Items.Count - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user