BusyArea.axaml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <UserControl
  2. x:Class="SukiUI.Controls.BusyArea"
  3. xmlns="https://github.com/avaloniaui"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:converters="https://github.com/kikipoulet/SukiUI"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. xmlns:suki="clr-namespace:SukiUI.Controls"
  9. d:DesignHeight="450"
  10. d:DesignWidth="800"
  11. mc:Ignorable="d">
  12. <UserControl.Styles>
  13. <Style Selector="suki|BusyArea DockPanel#LoadingBusyArea">
  14. <Setter Property="Transitions">
  15. <Transitions>
  16. <DoubleTransition Property="Opacity" Duration="0:0:0.3" />
  17. </Transitions>
  18. </Setter>
  19. </Style>
  20. <Style Selector="suki|BusyArea[IsBusy=True] /template/ DockPanel#LoadingBusyArea">
  21. <Setter Property="Opacity" Value="1" />
  22. </Style>
  23. <Style Selector="suki|BusyArea[IsBusy=False] /template/ DockPanel#LoadingBusyArea">
  24. <Setter Property="Opacity" Value="0" />
  25. </Style>
  26. <Style Selector="suki|BusyArea ContentControl">
  27. <Setter Property="Transitions">
  28. <Transitions>
  29. <DoubleTransition Property="Opacity" Duration="0:0:0.3" />
  30. </Transitions>
  31. </Setter>
  32. </Style>
  33. <Style Selector="suki|BusyArea[IsBusy=True] /template/ ContentControl#BusyContent">
  34. <Setter Property="Opacity" Value="0.1" />
  35. </Style>
  36. <Style Selector="suki|BusyArea[IsBusy=False] /template/ ContentControl#BusyContent">
  37. <Setter Property="Opacity" Value="1" />
  38. </Style>
  39. <Style Selector="suki|BusyArea">
  40. <Setter Property="Template">
  41. <ControlTemplate>
  42. <Panel>
  43. <ContentControl Name="BusyContent" Content="{TemplateBinding Content}" />
  44. <DockPanel
  45. Name="LoadingBusyArea"
  46. HorizontalAlignment="Center"
  47. VerticalAlignment="Center"
  48. LastChildFill="True">
  49. <TextBlock
  50. Margin="3"
  51. DockPanel.Dock="Bottom"
  52. FontWeight="{DynamicResource DefaultDemiBold}"
  53. IsVisible="{TemplateBinding BusyText,
  54. Converter={x:Static StringConverters.IsNotNullOrEmpty}}"
  55. Text="{TemplateBinding BusyText}" />
  56. <ContentPresenter
  57. HorizontalAlignment="Center"
  58. VerticalAlignment="Center"
  59. Content="{TemplateBinding IsBusy,
  60. Converter={x:Static converters:ProgressToContentCOnverter.Instance}}"
  61. IsHitTestVisible="False" />
  62. </DockPanel>
  63. </Panel>
  64. </ControlTemplate>
  65. </Setter>
  66. </Style>
  67. </UserControl.Styles>
  68. </UserControl>