瀏覽代碼

修复报警详情空值绑定 - 添加FallbackValue兜底

磊 曹 3 月之前
父節點
當前提交
5ad1f5f7fa
共有 1 個文件被更改,包括 4 次插入 和 4 次删除
  1. 4 4
      src/YZWater.Avalonia/Views/ViewDView.axaml

+ 4 - 4
src/YZWater.Avalonia/Views/ViewDView.axaml

@@ -72,19 +72,19 @@
                         IsVisible="{Binding SelectedRecord, Converter={x:Static ObjectConverters.IsNotNull}}">
                     <Grid ColumnDefinitions="80,*" RowDefinitions="Auto,Auto,Auto,Auto">
                         <TextBlock Grid.Row="0" Grid.Column="0" Text="TIME" FontFamily="{DynamicResource MonoFont}" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
-                        <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding SelectedRecord.AlarmTime, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}'}"
+                        <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding SelectedRecord.AlarmTime, StringFormat='{}{0:yyyy-MM-dd HH:mm:ss}', FallbackValue='--'}"
                                    FontFamily="{DynamicResource MonoFont}" FontSize="11" Foreground="{DynamicResource TextPrimaryBrush}"/>
 
                         <TextBlock Grid.Row="1" Grid.Column="0" Text="TYPE" FontFamily="{DynamicResource MonoFont}" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
-                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding SelectedRecord.AlarmType}"
+                        <TextBlock Grid.Row="1" Grid.Column="1" Text="{Binding SelectedRecord.AlarmType, FallbackValue='--'}"
                                    FontFamily="{DynamicResource MonoFont}" FontSize="11" Foreground="{DynamicResource WarningBrush}"/>
 
                         <TextBlock Grid.Row="2" Grid.Column="0" Text="MESSAGE" FontFamily="{DynamicResource MonoFont}" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
-                        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding SelectedRecord.AlarmMessage}"
+                        <TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding SelectedRecord.AlarmMessage, FallbackValue='--'}"
                                    FontFamily="{DynamicResource MonoFont}" FontSize="11" Foreground="{DynamicResource DangerBrush}"/>
 
                         <TextBlock Grid.Row="3" Grid.Column="0" Text="LEVEL" FontFamily="{DynamicResource MonoFont}" FontSize="10" Foreground="{DynamicResource TextTertiaryBrush}"/>
-                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding SelectedRecord.AlarmLevel, StringFormat='{}Level {0}'}"
+                        <TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding SelectedRecord.AlarmLevel, StringFormat='{}Level {0}', FallbackValue='--'}"
                                    FontFamily="{DynamicResource MonoFont}" FontSize="11" Foreground="{DynamicResource TextPrimaryBrush}"/>
                     </Grid>
                 </Border>