|
| 1 | +<UserControl |
| 2 | + x:Class="Riverside.Toolkit.Controls.SettingsBlockControl" |
| 3 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 4 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 5 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 6 | + xmlns:local="using:Riverside.Toolkit.Controls" |
| 7 | + xmlns:local1="using:Riverside.Toolkit.Converters" |
| 8 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 9 | + xmlns:muxc="using:Microsoft.UI.Xaml.Controls" |
| 10 | + d:DesignHeight="300" |
| 11 | + d:DesignWidth="400" |
| 12 | + mc:Ignorable="d"> |
| 13 | + |
| 14 | + <UserControl.Resources> |
| 15 | + <local1:InverseBooleanConverter x:Key="InverseBooleanConverter" /> |
| 16 | + <local1:NullToTrueConverter x:Key="NullToFalseConverter" Inverse="True" /> |
| 17 | + <local1:NullToTrueConverter x:Key="NullToTrueConverter" Inverse="False" /> |
| 18 | + <local1:StringNullOrWhiteSpaceToTrueConverter x:Key="StringNullOrWhiteSpaceToFalseConverter" Inverse="True" /> |
| 19 | + <local1:StringNullOrWhiteSpaceToTrueConverter x:Key="StringNullOrWhiteSpaceToTrueConverter" Inverse="False" /> |
| 20 | + |
| 21 | + <Style x:Key="TextBlockGroupHeaderStyle" TargetType="TextBlock"> |
| 22 | + <Setter Property="Margin" Value="0,8,0,4" /> |
| 23 | + <Setter Property="FontSize" Value="16" /> |
| 24 | + <Setter Property="TextWrapping" Value="Wrap" /> |
| 25 | + <Setter Property="FontWeight" Value="Bold" /> |
| 26 | + </Style> |
| 27 | + |
| 28 | + <Style x:Key="GridSettingsBlockStyle" TargetType="Grid"> |
| 29 | + <Setter Property="Background" Value="{ThemeResource ExpanderHeaderBackground}" /> |
| 30 | + <Setter Property="BorderBrush" Value="{ThemeResource ExpanderHeaderBorderBrush}" /> |
| 31 | + <Setter Property="BorderThickness" Value="{ThemeResource ExpanderHeaderBorderThickness}" /> |
| 32 | + <Setter Property="HorizontalAlignment" Value="Stretch" /> |
| 33 | + <Setter Property="MinHeight" Value="{StaticResource ExpanderMinHeight}" /> |
| 34 | + <Setter Property="Padding" Value="16,4,16,4" /> |
| 35 | + <Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" /> |
| 36 | + </Style> |
| 37 | + |
| 38 | + <Style |
| 39 | + x:Key="ButtonSettingsBlockStyle" |
| 40 | + BasedOn="{StaticResource DefaultButtonStyle}" |
| 41 | + TargetType="Button"> |
| 42 | + <Setter Property="Background" Value="{ThemeResource ExpanderHeaderBackground}" /> |
| 43 | + <Setter Property="BorderBrush" Value="{ThemeResource ExpanderHeaderBorderBrush}" /> |
| 44 | + <Setter Property="BorderThickness" Value="{ThemeResource ExpanderHeaderBorderThickness}" /> |
| 45 | + <Setter Property="HorizontalAlignment" Value="Stretch" /> |
| 46 | + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> |
| 47 | + <Setter Property="Padding" Value="16,4,16,4" /> |
| 48 | + <Setter Property="MinHeight" Value="{StaticResource ExpanderMinHeight}" /> |
| 49 | + <Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" /> |
| 50 | + </Style> |
| 51 | + </UserControl.Resources> |
| 52 | + |
| 53 | + <Grid> |
| 54 | + |
| 55 | + <!-- Expander --> |
| 56 | + <Grid x:Name="ExpanderPreGrid" x:Load="{x:Bind ExpandableContent, Mode=OneWay, Converter={StaticResource NullToFalseConverter}}"> |
| 57 | + <Grid x:Name="ExpanderGrid" x:Load="{x:Bind IsClickable, Mode=OneWay, Converter={StaticResource InverseBooleanConverter}}"> |
| 58 | + <muxc:Expander |
| 59 | + x:Name="ExpanderControl" |
| 60 | + HorizontalAlignment="Stretch" |
| 61 | + HorizontalContentAlignment="Stretch" |
| 62 | + AutomationProperties.Name="{x:Bind Title, Mode=OneWay}" |
| 63 | + Collapsed="Expander_Collapsed" |
| 64 | + Expanding="Expander_Expanding" |
| 65 | + IsExpanded="{x:Bind IsExpanded, Mode=TwoWay}"> |
| 66 | + <muxc:Expander.Header> |
| 67 | + <local:SettingsDisplayControl |
| 68 | + Title="{x:Bind Title, Mode=OneWay}" |
| 69 | + Margin="0,4" |
| 70 | + AdditionalDescriptionContent="{x:Bind AdditionalDescriptionContent, Mode=OneWay}" |
| 71 | + Description="{x:Bind Description, Mode=OneWay}" |
| 72 | + Icon="{x:Bind Icon, Mode=OneWay}" |
| 73 | + SettingsActionableElement="{x:Bind SettingsActionableElement, Mode=OneWay}" /> |
| 74 | + </muxc:Expander.Header> |
| 75 | + |
| 76 | + <ContentPresenter |
| 77 | + Margin="-16" |
| 78 | + HorizontalAlignment="Stretch" |
| 79 | + Content="{x:Bind ExpandableContent, Mode=OneWay}" /> |
| 80 | + </muxc:Expander> |
| 81 | + </Grid> |
| 82 | + </Grid> |
| 83 | + |
| 84 | + <!-- Button --> |
| 85 | + <Grid x:Name="ButtonPreGrid" x:Load="{x:Bind ExpandableContent, Mode=OneWay, Converter={StaticResource NullToTrueConverter}}"> |
| 86 | + <Grid x:Name="ButtonGrid" x:Load="{x:Bind IsClickable, Mode=OneWay}"> |
| 87 | + <Button |
| 88 | + x:Name="ActionableButton" |
| 89 | + Command="{x:Bind ButtonCommand, Mode=OneWay}" |
| 90 | + Style="{StaticResource ButtonSettingsBlockStyle}"> |
| 91 | + <local:SettingsDisplayControl |
| 92 | + Title="{x:Bind Title, Mode=OneWay}" |
| 93 | + AdditionalDescriptionContent="{x:Bind AdditionalDescriptionContent, Mode=OneWay}" |
| 94 | + Description="{x:Bind Description, Mode=OneWay}" |
| 95 | + Icon="{x:Bind Icon, Mode=OneWay}" |
| 96 | + SettingsActionableElement="{x:Bind SettingsActionableElement, Mode=OneWay}" /> |
| 97 | + </Button> |
| 98 | + </Grid> |
| 99 | + </Grid> |
| 100 | + |
| 101 | + <!-- Grid --> |
| 102 | + <Grid x:Name="StaticPreGrid" x:Load="{x:Bind ExpandableContent, Mode=OneWay, Converter={StaticResource NullToTrueConverter}}"> |
| 103 | + <Grid |
| 104 | + x:Name="StaticGrid" |
| 105 | + x:Load="{x:Bind IsClickable, Mode=OneWay, Converter={StaticResource InverseBooleanConverter}}" |
| 106 | + Style="{StaticResource GridSettingsBlockStyle}"> |
| 107 | + <local:SettingsDisplayControl |
| 108 | + Title="{x:Bind Title, Mode=OneWay}" |
| 109 | + AdditionalDescriptionContent="{x:Bind AdditionalDescriptionContent, Mode=OneWay}" |
| 110 | + Description="{x:Bind Description, Mode=OneWay}" |
| 111 | + Icon="{x:Bind Icon, Mode=OneWay}" |
| 112 | + SettingsActionableElement="{x:Bind SettingsActionableElement, Mode=OneWay}" /> |
| 113 | + </Grid> |
| 114 | + </Grid> |
| 115 | + |
| 116 | + </Grid> |
| 117 | +</UserControl> |
0 commit comments