Skip to content

Commit 41165b5

Browse files
committed
Merge branch 'master' of https://github.com/mgnslndh/MaterialDesignInXamlToolkit into mgnslndh-master
2 parents dd3c56b + a9d45a8 commit 41165b5

File tree

2 files changed

+58
-17
lines changed

2 files changed

+58
-17
lines changed

MainDemo.Wpf/Buttons.xaml

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
88
xmlns:wpfExample="clr-namespace:MaterialDesignColors.WpfExample"
99
mc:Ignorable="d"
10-
d:DesignHeight="300" d:DesignWidth="300">
10+
d:DesignHeight="400" d:DesignWidth="800">
1111
<UserControl.Resources>
1212
<ResourceDictionary>
1313
<ResourceDictionary.MergedDictionaries>
@@ -88,22 +88,55 @@
8888
</StackPanel>
8989
</materialDesign:PopupBox>
9090
</StackPanel>
91-
<materialDesign:PopupBox Style="{StaticResource MaterialDesignMultiFloatingActionAccentPopupBox}"
92-
PlacementMode="BottomAndAlignCentres"
93-
HorizontalAlignment="Right"
91+
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
92+
<materialDesign:PopupBox Margin="16,0,16,0" StaysOpen="True">
93+
<Grid Width="300" Margin="8,8,8,8">
94+
<Grid.Resources>
95+
<Style TargetType="CheckBox" BasedOn="{StaticResource MaterialDesignCheckBox}">
96+
<Setter Property="Margin" Value="8,8,8,8"/>
97+
</Style>
98+
<Style TargetType="TextBox" BasedOn="{StaticResource MaterialDesignTextBox}">
99+
<Setter Property="materialDesign:HintAssist.IsFloating" Value="True"/>
100+
<Setter Property="Margin" Value="8,16,8,8"/>
101+
</Style>
102+
</Grid.Resources>
103+
<Grid.ColumnDefinitions>
104+
<ColumnDefinition Width="*"/>
105+
<ColumnDefinition Width="Auto"/>
106+
</Grid.ColumnDefinitions>
107+
<Grid.RowDefinitions>
108+
<RowDefinition Height="*"/>
109+
<RowDefinition Height="*"/>
110+
<RowDefinition Height="*"/>
111+
<RowDefinition Height="*"/>
112+
</Grid.RowDefinitions>
113+
<TextBlock Grid.Column="0" Grid.Row="0" Style="{StaticResource MaterialDesignTitleTextBlock}" Margin="8,8,8,16">OPTIONS</TextBlock>
114+
<TextBox Grid.Column="0" Grid.Row="1" materialDesign:HintAssist.Hint="Setting 1" Text="200"/>
115+
<TextBox Grid.Column="0" Grid.Row="2" materialDesign:HintAssist.Hint="Setting 2" Text="400"/>
116+
<TextBox Grid.Column="0" Grid.Row="3" materialDesign:HintAssist.Hint="Setting 3" Text="600"/>
117+
<CheckBox Grid.Column="1" Grid.Row="1"/>
118+
<CheckBox Grid.Column="1" Grid.Row="2" IsChecked="True"/>
119+
<CheckBox Grid.Column="1" Grid.Row="3"/>
120+
</Grid>
121+
122+
</materialDesign:PopupBox>
123+
124+
<materialDesign:PopupBox Style="{StaticResource MaterialDesignMultiFloatingActionAccentPopupBox}"
125+
PlacementMode="BottomAndAlignCentres"
94126
ToggleCheckedContentCommand="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=wpfExample:Buttons}, Path=FloatingActionDemoCommand}"
95127
ToggleCheckedContentCommandParameter="wowsers"
96128
Margin="0 0 48 0"
97129
ToolTip="PopupBox, Style MaterialDesignMultiFloatingActionAccentPopupBox">
98-
<materialDesign:PopupBox.ToggleCheckedContent>
99-
<materialDesign:PackIcon Kind="Pencil" Width="24" Height="24" />
100-
</materialDesign:PopupBox.ToggleCheckedContent>
101-
<StackPanel>
102-
<Button ToolTip="One">1</Button>
103-
<Button ToolTip="Two">2</Button>
104-
<Button ToolTip="Three">3</Button>
105-
</StackPanel>
106-
</materialDesign:PopupBox>
130+
<materialDesign:PopupBox.ToggleCheckedContent>
131+
<materialDesign:PackIcon Kind="Pencil" Width="24" Height="24" />
132+
</materialDesign:PopupBox.ToggleCheckedContent>
133+
<StackPanel>
134+
<Button ToolTip="One">1</Button>
135+
<Button ToolTip="Two">2</Button>
136+
<Button ToolTip="Three">3</Button>
137+
</StackPanel>
138+
</materialDesign:PopupBox>
139+
</StackPanel>
107140
</Grid>
108141
<StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0 16 0 0">
109142
<Button Style="{StaticResource MaterialDesignRaisedLightButton}" Margin="0 0 8 0" Width="100"
@@ -122,7 +155,7 @@
122155
ToolTip="Resource name: MaterialDesignRaisedAccentButton">
123156
ACCENT
124157
</Button>
125-
158+
126159
</StackPanel>
127160
<StackPanel Grid.Row="3" Margin="0 16 0 0" Orientation="Horizontal">
128161
<Button Style="{StaticResource MaterialDesignRaisedAccentButton}"
@@ -216,7 +249,7 @@
216249
<TextBlock Margin="0 24 0 0" Grid.Row="9">Rating bar</TextBlock>
217250
<StackPanel Grid.Row="10" Margin="0 16 0 0" Orientation="Horizontal">
218251
<materialDesign:RatingBar Value="3" x:Name="BasicRatingBar" />
219-
<TextBlock Text="{Binding ElementName=BasicRatingBar, Path=Value, StringFormat=Rating: {0}}" VerticalAlignment="Top" Margin="10,2,0,0" />
252+
<TextBlock Text="{Binding ElementName=BasicRatingBar, Path=Value, StringFormat=Rating: {0}}" VerticalAlignment="Top" Margin="10,2,0,0" />
220253
<materialDesign:RatingBar x:Name="CustomRatingBar" Max="3" Value="2" Margin="24 0 0 0" Orientation="Vertical">
221254
<materialDesign:RatingBar.ValueItemTemplate>
222255
<DataTemplate DataType="system:Int32">

MaterialDesignThemes.Wpf/PopupBox.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -603,9 +603,17 @@ private static void OnLostMouseCapture(object sender, MouseEventArgs e)
603603
}
604604
}
605605
else
606-
{
607-
if (!popupBox.StaysOpen)
606+
{
607+
if (popupBox.StaysOpen)
608+
{
609+
// Take capture back because click happend outside of control
610+
Mouse.Capture(popupBox, CaptureMode.SubTree);
611+
e.Handled = true;
612+
}
613+
else
614+
{
608615
popupBox.Close();
616+
}
609617
}
610618
}
611619
}

0 commit comments

Comments
 (0)