Skip to content

Commit

Permalink
Small cleanup done during review on stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Keboo authored and nicolaihenriksen committed Mar 20, 2023
1 parent 5831ce4 commit fac1edd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
11 changes: 2 additions & 9 deletions MainDemo.Wpf/PopupBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,8 @@
</ResourceDictionary.MergedDictionaries>

<DataTemplate x:Key="ContentTemplateGrid">
<Grid Width="200" Height="100">
<TextBlock Text="Popup content in grid" HorizontalAlignment="Center" VerticalAlignment="Center">
<!-- This explicit style should not be needed; possibly because the MaterialDesignMultiFloatingActionPopupBox style enforces special brushes? Or perhaps an issue with correctly applying theming? -->
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource MaterialDesignTextBlock}">
<Setter Property="TextElement.Foreground" Value="{StaticResource MaterialDesignLightForeground}" />
</Style>
</TextBlock.Style>
</TextBlock>
<Grid Width="200" Height="100" TextElement.Foreground="{DynamicResource MaterialDesignLightForeground}">
<TextBlock Text="Popup content in grid" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</DataTemplate>

Expand Down
16 changes: 8 additions & 8 deletions MainDemo.Wpf/PopupBox.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@ public PopupBox()

internal class ComboBoxItemToDataTemplateConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> value is ComboBoxItem {Tag: DataTemplate template} ? template : null!;
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
=> value is ComboBoxItem { Tag: DataTemplate template} ? template : null;

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
=> throw new NotImplementedException();
}

internal class ComboBoxItemToStyleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
=> value is ComboBoxItem { Tag: Style style } ? style : null!;
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
=> value is ComboBoxItem { Tag: Style style } ? style : null;

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
=> throw new NotImplementedException();
}

internal class ComboBoxItemToHelperTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
=> value is ComboBoxItem item ? HintAssist.GetHelperText(item) : null!;

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
=> throw new NotImplementedException();
}

0 comments on commit fac1edd

Please sign in to comment.