Skip to content

Commit 3881f0e

Browse files
Merge pull request #117 from atc-net/feature/DialogBox-Header
feat: Improve dialogBox's on HeaderContent
2 parents 0a607ef + 14d175c commit 3881f0e

10 files changed

+147
-9
lines changed

src/Atc.Wpf.Controls/Dialogs/BasicApplicationSettingsDialogBox.xaml

+25-5
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,16 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:atc="https://github.com/atc-net/atc-wpf/tree/main/schemas"
6-
xmlns:atcTranslation="https://github.com/atc-net/atc-wpf/tree/main/schemas/translations"
6+
xmlns:atcValueConverters="https://github.com/atc-net/atc-wpf/tree/main/schemas/value-converters"
77
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
88
xmlns:dialogs="clr-namespace:Atc.Wpf.Theming.Themes.Dialogs;assembly=Atc.Wpf.Theming"
99
xmlns:local="clr-namespace:Atc.Wpf.Controls.Dialogs"
1010
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
1111
xmlns:settingsControls="clr-namespace:Atc.Wpf.Controls.SettingsControls"
1212
x:Name="DialogApplicationSettings"
13-
Title="{atcTranslation:Resx ResxName=Atc.Wpf.Controls.Resources.Miscellaneous,
14-
Key=ApplicationSettings}"
13+
Title="{Binding Path=TitleBarText}"
1514
Width="550"
16-
Height="300"
15+
Height="360"
1716
d:DataContext="{d:DesignInstance Type=local:BasicApplicationSettingsDialogBoxViewModel}"
1817
ShowCloseButton="False"
1918
ShowMaxRestoreButton="False"
@@ -22,9 +21,25 @@
2221
WindowStyle="SingleBorderWindow"
2322
mc:Ignorable="d">
2423

24+
<dialogs:NiceDialogBox.Resources>
25+
<atcValueConverters:ObjectNotNullToVisibilityVisibleValueConverter x:Key="ObjectNotNullToVisibilityVisibleValueConverter" />
26+
</dialogs:NiceDialogBox.Resources>
27+
2528
<DockPanel>
2629

2730
<Border
31+
x:Name="ContentTop"
32+
Height="50"
33+
Background="{DynamicResource AtcApps.Brushes.ThemeBackground1}"
34+
BorderBrush="{DynamicResource AtcApps.Brushes.Accent}"
35+
BorderThickness="0,0,0,1"
36+
DockPanel.Dock="Top"
37+
Visibility="{Binding Path=HeaderControl, Converter={StaticResource ObjectNotNullToVisibilityVisibleValueConverter}}">
38+
<ContentControl Content="{Binding Path=HeaderControl}" />
39+
</Border>
40+
41+
<Border
42+
x:Name="ContentButton"
2843
Height="50"
2944
Background="{DynamicResource AtcApps.Brushes.ThemeBackground1}"
3045
BorderBrush="{DynamicResource AtcApps.Brushes.Accent}"
@@ -55,7 +70,12 @@
5570
</atc:UniformSpacingPanel>
5671
</Border>
5772

58-
<settingsControls:BasicApplicationSettingsView Margin="20" DataContext="{Binding Path=ApplicationSettings}" />
73+
<ScrollViewer x:Name="ContentCenter" Padding="20">
74+
<settingsControls:BasicApplicationSettingsView
75+
Margin="20"
76+
VerticalAlignment="Center"
77+
DataContext="{Binding Path=ApplicationSettings}" />
78+
</ScrollViewer>
5979

6080
</DockPanel>
6181

src/Atc.Wpf.Controls/Dialogs/BasicApplicationSettingsDialogBoxViewModel.cs

+21
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ public BasicApplicationSettingsDialogBoxViewModel(
2121
ApplicationSettings = basicApplicationSettingsViewModel.Clone();
2222
applicationSettingsBackup = basicApplicationSettingsViewModel.Clone();
2323

24+
TitleBarText = Miscellaneous.ApplicationSettings;
25+
2426
ThemeManager.Current.ThemeChanged += OnThemeChanged;
2527
CultureManager.UiCultureChanged += OnUiCultureChanged;
2628
}
@@ -34,8 +36,27 @@ public BasicApplicationSettingsDialogBoxViewModel(
3436
dataDirectory = applicationDataDirectory;
3537
}
3638

39+
public string TitleBarText { get; set; }
40+
41+
public ContentControl? HeaderControl { get; set; }
42+
3743
public BasicApplicationSettingsViewModel ApplicationSettings { get; set; }
3844

45+
public void SetHeaderControlInsteadOfTitleBarText()
46+
{
47+
TitleBarText = string.Empty;
48+
HeaderControl = new ContentControl
49+
{
50+
HorizontalAlignment = HorizontalAlignment.Center,
51+
VerticalAlignment = VerticalAlignment.Center,
52+
Content = new TextBlock
53+
{
54+
Text = Miscellaneous.ApplicationSettings,
55+
FontSize = 24,
56+
},
57+
};
58+
}
59+
3960
public string ToJson()
4061
{
4162
var file = new FileInfo(

src/Atc.Wpf.Controls/Dialogs/InfoDialogBox.xaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@
2222
<DockPanel>
2323

2424
<Border
25+
x:Name="ContentTop"
2526
Height="50"
2627
Background="{DynamicResource AtcApps.Brushes.ThemeBackground1}"
2728
BorderBrush="{DynamicResource AtcApps.Brushes.Accent}"
2829
BorderThickness="0,0,0,1"
2930
DockPanel.Dock="Top"
3031
Visibility="{Binding Path=HeaderControl, Converter={StaticResource ObjectNotNullToVisibilityVisibleValueConverter}}">
31-
<ContentControl Margin="30" Content="{Binding Path=HeaderControl}" />
32+
<ContentControl Content="{Binding Path=HeaderControl}" />
3233
</Border>
3334

3435
<Border
36+
x:Name="ContentButton"
3537
Height="50"
3638
Background="{DynamicResource AtcApps.Brushes.ThemeBackground1}"
3739
BorderBrush="{DynamicResource AtcApps.Brushes.Accent}"

src/Atc.Wpf.Controls/Dialogs/InfoDialogBox.xaml.cs

+22
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,28 @@ public InfoDialogBox(
2727
Settings.TitleBarText = titleBarText;
2828
}
2929

30+
public InfoDialogBox(
31+
Window owningWindow,
32+
string titleBarText,
33+
string headerText,
34+
string contentText)
35+
: this(
36+
owningWindow,
37+
titleBarText,
38+
contentText)
39+
{
40+
HeaderControl = new ContentControl
41+
{
42+
HorizontalAlignment = HorizontalAlignment.Center,
43+
VerticalAlignment = VerticalAlignment.Center,
44+
Content = new TextBlock
45+
{
46+
Text = headerText,
47+
FontSize = 24,
48+
},
49+
};
50+
}
51+
3052
public InfoDialogBox(
3153
Window owningWindow,
3254
DialogBoxSettings settings,

src/Atc.Wpf.Controls/Dialogs/InputDialogBox.xaml

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,18 @@
2828
<DockPanel>
2929

3030
<Border
31+
x:Name="ContentTop"
3132
Height="50"
3233
Background="{DynamicResource AtcApps.Brushes.ThemeBackground1}"
3334
BorderBrush="{DynamicResource AtcApps.Brushes.Accent}"
3435
BorderThickness="0,0,0,1"
3536
DockPanel.Dock="Top"
3637
Visibility="{Binding Path=HeaderControl, Converter={StaticResource ObjectNotNullToVisibilityVisibleValueConverter}}">
37-
<ContentControl Margin="30" Content="{Binding Path=HeaderControl}" />
38+
<ContentControl Content="{Binding Path=HeaderControl}" />
3839
</Border>
3940

4041
<Border
42+
x:Name="ContentButton"
4143
Height="50"
4244
Background="{DynamicResource AtcApps.Brushes.ThemeBackground1}"
4345
BorderBrush="{DynamicResource AtcApps.Brushes.Accent}"

src/Atc.Wpf.Controls/Dialogs/InputDialogBox.xaml.cs

+22
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,28 @@ public InputDialogBox(
2727
Settings.TitleBarText = titleBarText;
2828
}
2929

30+
public InputDialogBox(
31+
Window owningWindow,
32+
string titleBarText,
33+
string headerText,
34+
ILabelControlBase labelControl)
35+
: this(
36+
owningWindow,
37+
titleBarText,
38+
labelControl)
39+
{
40+
HeaderControl = new ContentControl
41+
{
42+
HorizontalAlignment = HorizontalAlignment.Center,
43+
VerticalAlignment = VerticalAlignment.Center,
44+
Content = new TextBlock
45+
{
46+
Text = headerText,
47+
FontSize = 24,
48+
},
49+
};
50+
}
51+
3052
public InputDialogBox(
3153
Window owningWindow,
3254
DialogBoxSettings settings,

src/Atc.Wpf.Controls/Dialogs/InputFormDialogBox.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
BorderThickness="0,0,0,1"
3636
DockPanel.Dock="Top"
3737
Visibility="{Binding Path=HeaderControl, Converter={StaticResource ObjectNotNullToVisibilityVisibleValueConverter}}">
38-
<ContentControl Margin="30" Content="{Binding Path=HeaderControl}" />
38+
<ContentControl Content="{Binding Path=HeaderControl}" />
3939
</Border>
4040

4141
<Border

src/Atc.Wpf.Controls/Dialogs/InputFormDialogBox.xaml.cs

+24
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,30 @@ public InputFormDialogBox(
3030
Settings.TitleBarText = titleBarText;
3131
}
3232

33+
public InputFormDialogBox(
34+
Window owningWindow,
35+
string titleBarText,
36+
string headerText,
37+
ILabelControlsForm labelControlsForm)
38+
: this(
39+
owningWindow,
40+
titleBarText,
41+
labelControlsForm)
42+
{
43+
HeaderControl = new ContentControl
44+
{
45+
HorizontalAlignment = HorizontalAlignment.Center,
46+
VerticalAlignment = VerticalAlignment.Center,
47+
Content = new TextBlock
48+
{
49+
Text = headerText,
50+
FontSize = 24,
51+
},
52+
};
53+
54+
UpdateWidthAndHeight();
55+
}
56+
3357
public InputFormDialogBox(
3458
Window owningWindow,
3559
LabelInputFormPanelSettings formPanelSettings,

src/Atc.Wpf.Controls/Dialogs/QuestionDialogBox.xaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,18 @@
2828
<DockPanel>
2929

3030
<Border
31+
x:Name="ContentTop"
32+
Height="50"
3133
Background="{DynamicResource AtcApps.Brushes.ThemeBackground1}"
3234
BorderBrush="{DynamicResource AtcApps.Brushes.Accent}"
3335
BorderThickness="0,0,0,1"
3436
DockPanel.Dock="Top"
3537
Visibility="{Binding Path=HeaderControl, Converter={StaticResource ObjectNotNullToVisibilityVisibleValueConverter}}">
36-
<ContentControl Margin="30" Content="{Binding Path=HeaderControl}" />
38+
<ContentControl Content="{Binding Path=HeaderControl}" />
3739
</Border>
3840

3941
<Border
42+
x:Name="ContentButton"
4043
Height="50"
4144
Background="{DynamicResource AtcApps.Brushes.ThemeBackground1}"
4245
BorderBrush="{DynamicResource AtcApps.Brushes.Accent}"

src/Atc.Wpf.Controls/Dialogs/QuestionDialogBox.xaml.cs

+22
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,28 @@ public QuestionDialogBox(
2727
Settings.TitleBarText = titleBarText;
2828
}
2929

30+
public QuestionDialogBox(
31+
Window owningWindow,
32+
string titleBarText,
33+
string headerText,
34+
string contentText)
35+
: this(
36+
owningWindow,
37+
titleBarText,
38+
contentText)
39+
{
40+
HeaderControl = new ContentControl
41+
{
42+
HorizontalAlignment = HorizontalAlignment.Center,
43+
VerticalAlignment = VerticalAlignment.Center,
44+
Content = new TextBlock
45+
{
46+
Text = headerText,
47+
FontSize = 24,
48+
},
49+
};
50+
}
51+
3052
public QuestionDialogBox(
3153
Window owningWindow,
3254
DialogBoxSettings settings,

0 commit comments

Comments
 (0)