Ver código fonte

运行日志界面解决控件渲染卡顿。

master
ZhaoGang 1 ano atrás
pai
commit
35abe807d2
2 arquivos alterados com 154 adições e 92 exclusões
  1. +152
    -92
      BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
  2. +2
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs

+ 152
- 92
BPASmartClient.CustomResource/Pages/View/RunLogView.xaml Ver arquivo

@@ -54,7 +54,6 @@
<Setter Property="Foreground" Value="#FF2BD06F" />
<Setter Property="FontSize" Value="14" />
</Style>

<ControlTemplate x:Key="ButTemplate" TargetType="Button">
<Border
x:Name="br"
@@ -158,6 +157,7 @@
</StackPanel>

<!--#region 表格标题栏设置-->

<Grid
Grid.Row="1"
Margin="0,0,17,0"
@@ -230,112 +230,172 @@
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>-->

</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer

<!--<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Visible">

<Grid>
<!--#region 实时报警信息-->
<ItemsControl ItemsSource="{Binding Log}" Visibility="{Binding CurrentDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" MinHeight="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}"
TextWrapping="Wrap" />

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />
VerticalScrollBarVisibility="Visible">-->

<Grid Grid.Row="2">

<!--#region 实时报警信息-->

<ItemsControl
ItemsSource="{Binding Log}"
ScrollViewer.CanContentScroll="True"
VirtualizingStackPanel.IsVirtualizing="True"
Visibility="{Binding CurrentDataVis}">

<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Template>
<ControlTemplate>
<Border
Padding="{TemplateBinding Control.Padding}"
Background="{TemplateBinding Panel.Background}"
BorderBrush="{TemplateBinding Border.BorderBrush}"
BorderThickness="{TemplateBinding Border.BorderThickness}"
SnapsToDevicePixels="True">
<ScrollViewer Padding="{TemplateBinding Control.Padding}" Focusable="False">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
</ScrollViewer>
</Border>
</ControlTemplate>
</ItemsControl.Template>

<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" MinHeight="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->

<!--#region 历史报警信息-->
<ItemsControl ItemsSource="{Binding HistoryRunLog}" Visibility="{Binding HistoryDataVis}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" MinHeight="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />
<TextBlock
Grid.Column="2"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}"
TextWrapping="Wrap" />

<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

<!--#endregion-->

<!--#region 历史报警信息-->

<ItemsControl
ItemsSource="{Binding HistoryRunLog}"
ScrollViewer.CanContentScroll="True"
VirtualizingStackPanel.IsVirtualizing="True"
Visibility="{Binding HistoryDataVis}">

<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.Template>
<ControlTemplate>
<Border
Padding="{TemplateBinding Control.Padding}"
Background="{TemplateBinding Panel.Background}"
BorderBrush="{TemplateBinding Border.BorderBrush}"
BorderThickness="{TemplateBinding Border.BorderThickness}"
SnapsToDevicePixels="True">
<ScrollViewer Padding="{TemplateBinding Control.Padding}" Focusable="False">
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" />
</ScrollViewer>
</Border>
</ControlTemplate>
</ItemsControl.Template>

<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid x:Name="gr" MinHeight="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="150" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding Date}" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Time}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
<TextBlock
Grid.Column="2"
Margin="10,0,0,0"
HorizontalAlignment="Left"
Style="{StaticResource DataTextBlockStyle}"
Text="{Binding RunLogInfo}" />

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!--#endregion-->
</Grid>
</ScrollViewer>
<Border
Grid.ColumnSpan="6"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1" />

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

<!--#endregion-->

</Grid>
<!--</ScrollViewer>-->
<!--#endregion-->



</Grid>



+ 2
- 0
BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs Ver arquivo

@@ -131,5 +131,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public ObservableCollection<RunLog> HistoryRunLog { get; set; } = new ObservableCollection<RunLog>();

public ObservableCollection<RunLog> Log { get; set; } = MessageNotify.GetInstance.runLogs;

}
}

Carregando…
Cancelar
Salvar