Skip to content

Commit

Permalink
Merge pull request #397 from AndreasReitberger/396-add-sfpicker-style…
Browse files Browse the repository at this point in the history
…s-for-syncfusion

Added new `SfPicker` styles
  • Loading branch information
AndreasReitberger authored Dec 6, 2023
2 parents 3f54fb6 + 07e9288 commit 811bd49
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xaml-comp compile="true" ?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

xmlns:converters="clr-namespace:AndreasReitberger.Shared.Core.Converters;assembly=SharedMauiCoreLibrary"

xmlns:picker="clr-namespace:Syncfusion.Maui.Picker;assembly=Syncfusion.Maui.Picker"
xmlns:shared="clr-namespace:AndreasReitberger.Shared;assembly=SharedMauiXamlStylesLibrary"
>
<ResourceDictionary.MergedDictionaries>
<shared:Colors />
<shared:Fonts />
<ResourceDictionary Source="/Resources/Themes/SharedFonts.xaml" />
</ResourceDictionary.MergedDictionaries>

<converters:ColorToLightForgroundConverter x:Key="ColorToLightForgroundConverter" />
<converters:ColorToBlackWhiteConverter x:Key="ColorToBlackWhiteConverter" />
<converters:BrushToBlackWhiteConverter x:Key="BrushToBlackWhiteConverter" />

<Style x:Key="DefaultSfPickerStyle" TargetType="picker:SfPicker">
<Setter Property="ColumnDividerColor" Value="{DynamicResource PrimaryColor}" />
<Setter Property="Margin" Value="4,2"/>
<Setter Property="Background" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
<!--
<Setter Property="HeaderView">
<Setter.Value>
<picker:PickerHeaderView
DividerColor="{DynamicResource PrimaryColor}"
>
</picker:PickerHeaderView>
</Setter.Value>
</Setter>
-->
<Setter Property="SelectionView">
<Setter.Value>
<picker:PickerSelectionView
CornerRadius="10"
Padding="10, 5, 10, 5"
Background="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray100}}"
>
</picker:PickerSelectionView>
</Setter.Value>
</Setter>
<Setter Property="TextStyle">
<Setter.Value>
<picker:PickerTextStyle
FontSize="12"
FontFamily="{StaticResource MontserratRegular}"
TextColor="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray100}}"
>
</picker:PickerTextStyle>
</Setter.Value>
</Setter>
<Setter Property="SelectedTextStyle">
<Setter.Value>
<picker:PickerTextStyle
FontSize="12"
FontFamily="{StaticResource MontserratRegular}"
TextColor="{Binding Source={RelativeSource AncestorType={x:Type picker:SfPicker}}, Path=Background, Converter={StaticResource BrushToBlackWhiteConverter}}"
>
</picker:PickerTextStyle>
</Setter.Value>
</Setter>
<!--
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
<VisualStateGroup>
<VisualState x:Name="Default">
<VisualState.Setters>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Disabled">
<VisualState.Setters>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</Setter>
-->
</Style>
<Style TargetType="picker:SfPicker" BasedOn="{StaticResource DefaultSfPickerStyle}"/>

<Style x:Key="DefaultSfDateTimePickerStyle" TargetType="picker:SfDateTimePicker">
<Setter Property="ColumnDividerColor" Value="{DynamicResource PrimaryColor}" />
<Setter Property="Margin" Value="4,2"/>
<Setter Property="Background" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
<Setter Property="TimeFormat" Value="HH_mm" />
<!--
<Setter Property="HeaderView">
<Setter.Value>
<picker:DateTimePickerHeaderView
DividerColor="{DynamicResource PrimaryColor}"
TimeFormat="HH:mm"
>
<picker:DateTimePickerHeaderView.SelectionTextStyle>
<picker:PickerTextStyle
FontSize="12"
FontFamily="{StaticResource MontserratRegular}"
TextColor="{DynamicResource PrimaryColor}"
/>
</picker:DateTimePickerHeaderView.SelectionTextStyle>
</picker:DateTimePickerHeaderView>
</Setter.Value>
</Setter>
-->
<Setter Property="SelectionView">
<Setter.Value>
<picker:PickerSelectionView
CornerRadius="10"
Padding="10, 5, 10, 5"
Background="{DynamicResource PrimaryColor}"
>
</picker:PickerSelectionView>
</Setter.Value>
</Setter>
<Setter Property="TextStyle">
<Setter.Value>
<picker:PickerTextStyle
FontSize="12"
FontFamily="{StaticResource MontserratRegular}"
TextColor="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray100}}"
>
</picker:PickerTextStyle>
</Setter.Value>
</Setter>
<Setter Property="SelectedTextStyle">
<Setter.Value>
<picker:PickerTextStyle
FontSize="12"
FontFamily="{StaticResource MontserratRegular}"
TextColor="{Binding Source={RelativeSource AncestorType={x:Type picker:SfDateTimePicker}}, Path=Background, Converter={StaticResource BrushToBlackWhiteConverter}}"
>
</picker:PickerTextStyle>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="picker:SfDateTimePicker" BasedOn="{StaticResource DefaultSfDateTimePickerStyle}"/>

</ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ResourceDictionary Source="/Resources/Themes/Controls/SfListView.xaml" />
<ResourceDictionary Source="/Resources/Themes/Controls/SfMaskedEntry.xaml" />
<ResourceDictionary Source="/Resources/Themes/Controls/SfNumericEntry.xaml" />
<ResourceDictionary Source="/Resources/Themes/Controls/SfPicker.xaml" />
<ResourceDictionary Source="/Resources/Themes/Controls/SfRadialGauge.xaml" />
<ResourceDictionary Source="/Resources/Themes/Controls/SfSlider.xaml" />
<ResourceDictionary Source="/Resources/Themes/Controls/SfRating.xaml" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,17 @@

<ItemGroup>
<ProjectReference Include="..\SharedMauiXamlStylesLibrary\SharedMauiXamlStylesLibrary.csproj" />
<PackageReference Include="Syncfusion.Maui.Charts" Version="23.2.4" />
<PackageReference Include="Syncfusion.Maui.Core" Version="23.2.4" />
<PackageReference Include="Syncfusion.Maui.DataGrid" Version="23.2.4" />
<PackageReference Include="Syncfusion.Maui.Expander" Version="23.2.4" />
<PackageReference Include="Syncfusion.Maui.Gauges" Version="23.2.4" />
<PackageReference Include="Syncfusion.Maui.Inputs" Version="23.2.4" />
<PackageReference Include="Syncfusion.Maui.ListView" Version="23.2.4" />
<PackageReference Include="Syncfusion.Maui.Scheduler" Version="23.2.4" />
<PackageReference Include="Syncfusion.Maui.Sliders" Version="23.2.4" />
<PackageReference Include="Syncfusion.Maui.TabView" Version="23.2.4" />
<PackageReference Include="Syncfusion.Maui.Charts" Version="23.2.6" />
<PackageReference Include="Syncfusion.Maui.Core" Version="23.2.6" />
<PackageReference Include="Syncfusion.Maui.DataGrid" Version="23.2.6" />
<PackageReference Include="Syncfusion.Maui.Expander" Version="23.2.6" />
<PackageReference Include="Syncfusion.Maui.Gauges" Version="23.2.6" />
<PackageReference Include="Syncfusion.Maui.Inputs" Version="23.2.6" />
<PackageReference Include="Syncfusion.Maui.ListView" Version="23.2.6" />
<PackageReference Include="Syncfusion.Maui.Picker" Version="23.2.6" />
<PackageReference Include="Syncfusion.Maui.Scheduler" Version="23.2.6" />
<PackageReference Include="Syncfusion.Maui.Sliders" Version="23.2.6" />
<PackageReference Include="Syncfusion.Maui.TabView" Version="23.2.6" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -103,6 +104,9 @@
</ItemGroup>

<ItemGroup>
<MauiXaml Update="Resources\Themes\Controls\SfPicker.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
<MauiXaml Update="Resources\Themes\SyncfusionTheme.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Resources/Themes/SharedColors.xaml" />
<ResourceDictionary Source="/Resources/Themes/SharedFonts.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style x:Key="DefaultEditorStyle" TargetType="Editor">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontFamily" Value="{StaticResource MontserratRegular}"/>
<Setter Property="FontSize" Value="Default" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
<Setter Property="VisualStateManager.VisualStateGroups">
Expand All @@ -35,7 +36,7 @@

<Style x:Key="DefaultBorderlessEditorStyle" TargetType="control:BorderlessEditor">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontFamily" Value="{StaticResource MontserratRegular}"/>
<Setter Property="FontSize" Value="Default" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource LightGray}, Dark={StaticResource DarkGray}}" />
<Setter Property="Background" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Resources/Themes/SharedColors.xaml" />
<ResourceDictionary Source="/Resources/Themes/SharedFonts.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style x:Key="DefaultPickerStyle" TargetType="Picker">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource DarkGray}, Dark={StaticResource LightGray}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontFamily" Value="{StaticResource MontserratRegular}"/>
<Setter Property="FontSize" Value="Default"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Resources/Themes/SharedColors.xaml" />
<ResourceDictionary Source="/Resources/Themes/SharedFonts.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style x:Key="DefaultRadioButtonStyle" TargetType="RadioButton">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontFamily" Value="{StaticResource MontserratRegular}"/>
<Setter Property="FontSize" Value="Default"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Resources/Themes/SharedColors.xaml" />
<ResourceDictionary Source="/Resources/Themes/SharedFonts.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style x:Key="DefaultSearchBarStyle" TargetType="SearchBar">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray800}}" />
<Setter Property="CancelButtonColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray800}}" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
<Setter Property="FontFamily" Value="{StaticResource MontserratRegular}" />
<Setter Property="FontSize" Value="Default" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Resources/Themes/SharedColors.xaml" />
<ResourceDictionary Source="/Resources/Themes/SharedFonts.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style x:Key="DefaultSearchHandlerStyle" TargetType="SearchHandler">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="PlaceholderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray800}}" />
<Setter Property="FontFamily" Value="OpenSansRegular" />
<Setter Property="FontFamily" Value="{StaticResource MontserratRegular}" />
<Setter Property="FontSize" Value="Default" />
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Resources/Themes/SharedColors.xaml" />
<ResourceDictionary Source="/Resources/Themes/SharedFonts.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style x:Key="DefaultSliderStyle" TargetType="Slider">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Resources/Themes/SharedColors.xaml" />
<ResourceDictionary Source="/Resources/Themes/SharedFonts.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style x:Key="DefaultTimePickerStyle" TargetType="TimePicker">
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Black}, Dark={StaticResource White}}" />
<Setter Property="FontFamily" Value="OpenSansRegular"/>
<Setter Property="FontFamily" Value="{StaticResource MontserratRegular}"/>
<Setter Property="FontSize" Value="Default"/>
<Setter Property="VisualStateManager.VisualStateGroups">
<VisualStateGroupList>
Expand Down

0 comments on commit 811bd49

Please sign in to comment.