OilMinView.axaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <UserControl
  2. x:Class="OilSourceControl.View.OilMinView"
  3. xmlns="https://github.com/avaloniaui"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:ivm="using:IViewModel"
  7. xmlns:local="using:OilSourceControl"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:suki="https://github.com/kikipoulet/SukiUI"
  10. xmlns:vm="using:OilSourceControl.ViewModel"
  11. d:DesignHeight="450"
  12. d:DesignWidth="150"
  13. x:DataType="vm:OilSourceStatusViewModel"
  14. DataContext="{Binding Source={x:Static vm:OilSourceStatusViewModel.Instance}}"
  15. mc:Ignorable="d">
  16. <Expander ExpandDirection="Down">
  17. <Expander.Header>
  18. <TextBlock
  19. FontSize="24"
  20. FontWeight="Bold"
  21. Text="{DynamicResource OilStatus}" />
  22. </Expander.Header>
  23. <ItemsControl ItemsSource="{Binding OilSourceAnalogs}">
  24. <ItemsControl.ItemTemplate>
  25. <DataTemplate>
  26. <StackPanel>
  27. <TextBlock
  28. HorizontalAlignment="Center"
  29. VerticalAlignment="Center"
  30. FontSize="24"
  31. Foreground="{StaticResource OilDefaultColor}"
  32. Text="{ivm:ResourceBinding Name}" />
  33. <TextBlock
  34. HorizontalAlignment="Center"
  35. VerticalAlignment="Center"
  36. Classes.IsError="{Binding IsError}"
  37. Classes.IsWarn="{Binding IsWarn}"
  38. FontSize="26"
  39. FontWeight="Bold">
  40. <Run Text="{Binding Value, StringFormat='{}{0:0.00}'}" />
  41. <Run Text="{Binding Unit}" />
  42. <TextBlock.Styles>
  43. <Style Selector="TextBlock">
  44. <Setter Property="Foreground" Value="{StaticResource OilDefaultColor}" />
  45. </Style>
  46. <Style Selector="TextBlock.IsError">
  47. <Setter Property="Foreground" Value="{StaticResource ErrorColor}" />
  48. </Style>
  49. <Style Selector="TextBlock.IsWarn">
  50. <Setter Property="Foreground" Value="{StaticResource WarnColor}" />
  51. </Style>
  52. </TextBlock.Styles>
  53. </TextBlock>
  54. </StackPanel>
  55. </DataTemplate>
  56. </ItemsControl.ItemTemplate>
  57. </ItemsControl>
  58. </Expander>
  59. </UserControl>