Skip to content

Commit b0af342

Browse files
committed
Merged branch master into additional-popupbox-styles
2 parents 291c734 + cced4c8 commit b0af342

12 files changed

+133
-71
lines changed

MainDemo.Wpf/Buttons.xaml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,29 @@
304304
</ListBoxItem>
305305
</ListBox>
306306

307-
<ListBox Grid.Column="1" Grid.Row="1" Style="{StaticResource MaterialDesignToolToggleListBox}"
307+
<ListBox Grid.Column="1" Grid.Row="1" Style="{StaticResource MaterialDesignToolToggleFlatListBox}" SelectedIndex="0">
308+
<ListBox.ToolTip>
309+
<StackPanel>
310+
<TextBlock Text="MaterialDesignToolToggleFlatListBox" />
311+
<TextBlock Text="Exclusive selection" />
312+
<TextBlock Text="ListBoxAssist.IsToggle allows more natural toggle behaviour" />
313+
</StackPanel>
314+
</ListBox.ToolTip>
315+
<ListBoxItem>
316+
<materialDesign:PackIcon Kind="FormatAlignLeft"/>
317+
</ListBoxItem>
318+
<ListBoxItem>
319+
<materialDesign:PackIcon Kind="FormatAlignCenter"/>
320+
</ListBoxItem>
321+
<ListBoxItem>
322+
<materialDesign:PackIcon Kind="FormatAlignRight"/>
323+
</ListBoxItem>
324+
<ListBoxItem>
325+
<materialDesign:PackIcon Kind="FormatAlignJustify"/>
326+
</ListBoxItem>
327+
</ListBox>
328+
329+
<ListBox Grid.Column="1" Grid.Row="2" Style="{StaticResource MaterialDesignToolToggleListBox}"
308330
SelectionMode="Extended"
309331
Margin="0 8 0 0">
310332
<ListBox.ToolTip>

MainDemo.Wpf/Cards.xaml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,47 @@
4444
</StackPanel>
4545
</Grid>
4646
</materialDesign:Card>
47+
<materialDesign:Card Margin="4 4 0 0" Background="#03a9f4"
48+
Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
49+
Padding="0"
50+
Width="200">
51+
<Grid>
52+
<Grid.RowDefinitions>
53+
<RowDefinition Height="Auto" />
54+
<RowDefinition Height="Auto" />
55+
<RowDefinition Height="Auto" />
56+
</Grid.RowDefinitions>
57+
<TextBlock Grid.Row="0" Margin="16 16 16 4" Style="{StaticResource MaterialDesignHeadlineTextBlock}">Call Jennifer</TextBlock>
58+
<Separator Grid.Row="1" Style="{StaticResource MaterialDesignDarkSeparator}"/>
59+
<TextBlock Grid.Row="2" Margin="16 0 16 8" VerticalAlignment="Center" HorizontalAlignment="Left" Style="{StaticResource MaterialDesignBody1TextBlock}">March 19, 2016</TextBlock>
60+
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="16 0 16 8" HorizontalAlignment="Right">
61+
<Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignToolForegroundButton}" Width="30" Padding="2 0 2 0"
62+
materialDesign:RippleAssist.IsCentered="True">
63+
<materialDesign:PackIcon Kind="Phone" />
64+
</Button>
65+
</StackPanel>
66+
</Grid>
67+
</materialDesign:Card>
4768
<materialDesign:Card Margin="4 4 0 0" Background="{DynamicResource PrimaryHueLightBrush}"
4869
Foreground="{DynamicResource PrimaryHueLightForegroundBrush}"
4970
Padding="8">
5071
<TextBlock FontSize="16">Boring Text</TextBlock>
5172
</materialDesign:Card>
5273
<materialDesign:Card Margin="4 4 0 0" Background="{DynamicResource PrimaryHueDarkBrush}"
5374
Foreground="{DynamicResource PrimaryHueDarkForegroundBrush}"
54-
Padding="8">
75+
>
5576
<StackPanel>
56-
<TextBlock FontSize="16">Notes</TextBlock>
57-
<CheckBox Margin="0 4 0 0" Style="{StaticResource MaterialDesignUserForegroundCheckBox}">Do something good</CheckBox>
58-
<CheckBox Style="{StaticResource MaterialDesignUserForegroundCheckBox}">Take a breather</CheckBox>
59-
<CheckBox Style="{StaticResource MaterialDesignUserForegroundCheckBox}">And go create</CheckBox>
77+
<TextBlock Margin="16 16 12 8" FontSize="16">Notes</TextBlock>
78+
<CheckBox Margin="16 4 16 0" Style="{StaticResource MaterialDesignUserForegroundCheckBox}">Do something good</CheckBox>
79+
<CheckBox Margin="16 4 16 0" Style="{StaticResource MaterialDesignUserForegroundCheckBox}">Take a breather</CheckBox>
80+
<CheckBox Margin="16 4 16 0" Style="{StaticResource MaterialDesignUserForegroundCheckBox}">And go create</CheckBox>
81+
<Separator Style="{StaticResource MaterialDesignLightSeparator}"/>
82+
<StackPanel Margin="8 0 8 8" Orientation="Horizontal" HorizontalAlignment="Right">
83+
<Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignToolForegroundButton}" Width="30" Padding="2 0 0 0"
84+
materialDesign:RippleAssist.IsCentered="True">
85+
<materialDesign:PackIcon Kind="CheckAll" />
86+
</Button>
87+
</StackPanel>
6088
</StackPanel>
6189
</materialDesign:Card>
6290
<materialDesign:Card Margin="4 4 0 0" Background="{DynamicResource PrimaryHueDarkBrush}"

MainDemo.Wpf/Lists.xaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,22 @@
1414
</ResourceDictionary>
1515
</UserControl.Resources>
1616
<Grid Margin="8">
17+
<Grid.RowDefinitions>
18+
<RowDefinition/>
19+
<RowDefinition Height="Auto"/>
20+
</Grid.RowDefinitions>
1721
<Grid.ColumnDefinitions>
1822
<ColumnDefinition Width="1*" />
1923
<ColumnDefinition Width="1*" />
2024
<ColumnDefinition Width="1*" />
2125
</Grid.ColumnDefinitions>
22-
<ListBox Grid.Column="0">
26+
<ListBox Grid.Column="0" IsEnabled="{Binding IsChecked, ElementName=EnableListBox}">
2327
<TextBlock>Plain</TextBlock>
2428
<TextBlock>Old</TextBlock>
2529
<TextBlock>ListBox</TextBlock>
2630
<TextBlock>Full of junk</TextBlock>
2731
</ListBox>
32+
<CheckBox Name="EnableListBox" Grid.Row="1" IsChecked="True">Enabled</CheckBox>
2833
<!-- piece together your own items control to create some nice stuff that will make everyone think you are cool. and rightly so, because you are cool. you might even be a hipster for all I know -->
2934
<ItemsControl Grid.Column="1" ItemsSource="{Binding Items1}"
3035
Grid.IsSharedSizeScope="True"

MainDemo.Wpf/TextFields.xaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,11 @@
205205
<TextBox Grid.Row="6" Grid.Column="3"
206206
materialDesign:HintAssist.Hint="Large Font"
207207
materialDesign:TextFieldAssist.TextBoxViewMargin="1 0 1 0"
208-
materialDesign:HintAssist.FloatingScale="0.54"
209-
materialDesign:HintAssist.FloatingOffset="1,-54"
208+
materialDesign:HintAssist.FloatingScale="0.50"
210209
Text="Some Text"
211210
Style="{StaticResource MaterialDesignFloatingHintTextBox}"
212211
FontSize="24"/>
213-
212+
214213
<TextBlock Grid.Row="7" Grid.Column="1" Style="{StaticResource MaterialDesignSubheadingTextBlock}"
215214
Margin="0 48 0 0">DataTemplate Test</TextBlock>
216215
<ContentControl Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="4"

MaterialDesignThemes.Wpf/HintAssist.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public static void SetFloatingScale(DependencyObject element, double value)
4646
"FloatingOffset",
4747
typeof(Point),
4848
typeof(HintAssist),
49-
new FrameworkPropertyMetadata(new Point(1, -27), FrameworkPropertyMetadataOptions.Inherits));
49+
new FrameworkPropertyMetadata(new Point(1, -16), FrameworkPropertyMetadataOptions.Inherits));
5050

5151
public static Point GetFloatingOffset(DependencyObject element)
5252
{

MaterialDesignThemes.Wpf/PopupBox.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -423,14 +423,18 @@ protected override void OnMouseEnter(MouseEventArgs e)
423423
{
424424
//if the invisible popup that is watching the mouse, isn't where we expected it to be
425425
//then the main popup toggle has been moved off screen...so we shouldn't show the popup content
426-
var popupScreenPoint = _popupContentControl.PointToScreen(new Point());
427-
popupScreenPoint.Offset(-_popupContentControl.Margin.Left, -_popupContentControl.Margin.Top);
428-
var expectedPopupScreenPoint = PointToScreen(_popupPointFromLastRequest);
429-
430-
if (Math.Abs(popupScreenPoint.X - expectedPopupScreenPoint.X) > ActualWidth/3
431-
||
432-
Math.Abs(popupScreenPoint.Y - expectedPopupScreenPoint.Y) > ActualHeight/3)
433-
return;
426+
var inputSource = PresentationSource.FromVisual(_popupContentControl);
427+
if (inputSource != null)
428+
{
429+
var popupScreenPoint = _popupContentControl.PointToScreen(new Point());
430+
popupScreenPoint.Offset(-_popupContentControl.Margin.Left, -_popupContentControl.Margin.Top);
431+
var expectedPopupScreenPoint = PointToScreen(_popupPointFromLastRequest);
432+
433+
if (Math.Abs(popupScreenPoint.X - expectedPopupScreenPoint.X) > ActualWidth/3
434+
||
435+
Math.Abs(popupScreenPoint.Y - expectedPopupScreenPoint.Y) > ActualHeight/3)
436+
return;
437+
}
434438
}
435439

436440
SetCurrentValue(IsPopupOpenProperty, true);

MaterialDesignThemes.Wpf/SmartHint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public double FloatingScale
8888
}
8989

9090
public static readonly DependencyProperty FloatingOffsetProperty = DependencyProperty.Register(
91-
nameof(FloatingOffset), typeof(Point), typeof(SmartHint), new PropertyMetadata(new Point(1, -27)));
91+
nameof(FloatingOffset), typeof(Point), typeof(SmartHint), new PropertyMetadata(new Point(1, -16)));
9292

9393
public Point FloatingOffset
9494
{

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Defaults.xaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
<SolidColorBrush x:Key="MaterialDesignLightForeground" Color="#DD000000"/>
4141
<SolidColorBrush x:Key="MaterialDesignDarkBackground" Color="#FF37474f"/>
4242
<SolidColorBrush x:Key="MaterialDesignDarkForeground" Color="#FFFAFAFA"/>
43+
<SolidColorBrush x:Key="MaterialDesignDarkSeparatorBackground" Color="#1F000000" />
44+
<SolidColorBrush x:Key="MaterialDesignLightSeparatorBackground" Color="#1FFFFFFF" />
4345
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignRaisedButton}" />
4446
<Style TargetType="{x:Type Calendar}" BasedOn="{StaticResource MaterialDesignCalendarPortrait}" />
4547
<Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource MaterialDesignCheckBox}" />
@@ -73,4 +75,12 @@
7375
<Style TargetType="{x:Type Menu}" BasedOn="{StaticResource MaterialDesignMenu}" />
7476
<Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource MaterialDesignMenuItem}" />
7577
<Style x:Key="{x:Static MenuItem.SeparatorStyleKey}" TargetType="{x:Type Separator}" BasedOn="{StaticResource MaterialDesignSeparator}" />
78+
<Style x:Key="MaterialDesignDarkSeparator" TargetType="{x:Type Separator}" BasedOn="{StaticResource MaterialDesignSeparator}">
79+
<Setter Property="Background" Value="{DynamicResource MaterialDesignDarkSeparatorBackground}"/>
80+
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignDarkSeparatorBackground}"/>
81+
</Style>
82+
<Style x:Key="MaterialDesignLightSeparator" TargetType="{x:Type Separator}" BasedOn="{StaticResource MaterialDesignSeparator}">
83+
<Setter Property="Background" Value="{DynamicResource MaterialDesignLightSeparatorBackground}"/>
84+
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignLightSeparatorBackground}"/>
85+
</Style>
7686
</ResourceDictionary>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.Expander.xaml

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@
167167
<ColumnDefinition Width="Auto"/>
168168
</Grid.ColumnDefinitions>
169169
<ContentPresenter Content="{TemplateBinding Content}"
170+
ContentTemplate="{TemplateBinding ContentTemplate}"
171+
ContentStringFormat="{TemplateBinding ContentStringFormat}"
172+
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
170173
VerticalAlignment="Center"
171174
Margin="16 16 0 16" />
172175
<ToggleButton Grid.Column="1"
@@ -233,10 +236,7 @@
233236
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Visibility">
234237
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
235238
</ObjectAnimationUsingKeyFrames>
236-
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content"
237-
To="1" Duration="0:0:0.3"/>
238-
<DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ContentPanel"
239-
To="1" Duration="0:0:0.3"/>
239+
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content" To="1" Duration="0:0:0.3"/>
240240
</Storyboard>
241241
</VisualTransition>
242242
<VisualTransition GeneratedDuration="0" To="Collapsed">
@@ -247,17 +247,13 @@
247247
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Visibility">
248248
<DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="{x:Static Visibility.Collapsed}" />
249249
</ObjectAnimationUsingKeyFrames>
250-
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content"
251-
To="0" Duration="0:0:0.3"/>
252-
<DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ContentPanel"
253-
To="0" Duration="0:0:0.3"/>
250+
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content" To="0" Duration="0:0:0.3"/>
254251
</Storyboard>
255252
</VisualTransition>
256253
</VisualStateGroup.Transitions>
257254
<VisualState x:Name="Expanded">
258255
<Storyboard>
259256
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content" To="1" Duration="0"/>
260-
<DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ContentPanel" To="1" Duration="0"/>
261257
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Visibility">
262258
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
263259
</ObjectAnimationUsingKeyFrames>
@@ -266,7 +262,6 @@
266262
<VisualState x:Name="Collapsed">
267263
<Storyboard>
268264
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="PART_Content" To="0" Duration="0"/>
269-
<DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ContentPanel" To="0" Duration="0"/>
270265
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_Content" Storyboard.TargetProperty="Visibility">
271266
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Hidden}" />
272267
</ObjectAnimationUsingKeyFrames>
@@ -291,19 +286,16 @@
291286
DockPanel.Dock="Bottom">
292287
<StackPanel Name="ContentPanel"
293288
HorizontalAlignment="Left">
294-
<StackPanel.Tag>
295-
<system:Double>0.0</system:Double>
296-
</StackPanel.Tag>
297289
<StackPanel.Height>
298290
<MultiBinding Converter="{StaticResource MathMlpMultipleConverter}">
299291
<Binding ElementName="PART_Content" Path="ActualHeight"/>
300-
<Binding RelativeSource="{RelativeSource Self}" Path="Tag"/>
292+
<Binding ElementName="PART_Content" Path="Opacity"/>
301293
</MultiBinding>
302294
</StackPanel.Height>
303295
<StackPanel.Width>
304296
<MultiBinding Converter="{StaticResource MathMlpMultipleConverter}">
305297
<Binding ElementName="PART_Content" Path="ActualWidth"/>
306-
<Binding RelativeSource="{RelativeSource Self}" Path="Tag"/>
298+
<Binding ElementName="PART_Content" Path="Opacity"/>
307299
</MultiBinding>
308300
</StackPanel.Width>
309301
<ContentPresenter Name="PART_Content" Focusable="False"

0 commit comments

Comments
 (0)