Skip to content

Commit d8c05d6

Browse files
committed
[WinUI] Calcite integration (#1681)
1 parent 8d02b8a commit d8c05d6

File tree

22 files changed

+109
-135
lines changed

22 files changed

+109
-135
lines changed

src/Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<PackageVersion Include="Esri.ArcGISRuntime.Hydrography" Version="$(ArcGISMapsSDKVersion)" />
1414
<PackageVersion Include="Esri.ArcGISRuntime.Toolkit.WinUI" Version="$(ArcGISMapsSDKVersion)" />
1515
<PackageVersion Include="Esri.Calcite.Maui" Version="0.1.0-preview1" />
16+
<PackageVersion Include="Esri.Calcite.WinUI" Version="1.0.0-rc.1" />
1617
<PackageVersion Include="Markdig" Version="0.37.0" />
1718
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.3537.50" />
1819
<PackageVersion Include="System.Text.Json" Version="9.0.2" />

src/WinUI/ArcGIS.WinUI.Viewer/ApiKeyPrompt.xaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@
3232
<StackPanel Orientation="Horizontal">
3333
<Button x:Name="SetKeyButton"
3434
Margin="5"
35+
Style="{StaticResource CalciteSecondaryButtonStyle}"
3536
Click="SetKeyButton_Click"
3637
Content="Set API key" />
3738
<Button x:Name="DeleteKeyButton"
3839
Margin="5"
40+
Style="{StaticResource CalciteDangerSecondaryButtonStyle}"
3941
Click="DeleteKeyButton_Click"
4042
Content="Delete API key" />
4143
</StackPanel>

src/WinUI/ArcGIS.WinUI.Viewer/App.xaml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,39 @@
55
<Application.Resources>
66
<ResourceDictionary>
77
<ResourceDictionary.MergedDictionaries>
8+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls">
9+
<XamlControlsResources.MergedDictionaries>
10+
<CalciteResources xmlns="using:Esri.Calcite.WinUI" />
11+
</XamlControlsResources.MergedDictionaries>
12+
</XamlControlsResources>
13+
14+
<ResourceDictionary>
15+
<!--Manually set implicit style overrides due to WinUI bug-->
16+
<Style TargetType="Button" BasedOn="{StaticResource CalciteButtonStyle}" />
17+
<Style TargetType="TextBox" BasedOn="{StaticResource CalciteTextBoxStyle}" />
18+
</ResourceDictionary>
19+
20+
<ResourceDictionary>
21+
<!--Override calcite toolkit default colors with sample viewer theme colors-->
22+
<ResourceDictionary.ThemeDictionaries>
23+
<ResourceDictionary x:Key="Default">
24+
<Color x:Key="CalciteBrandColor" >#8F53CA</Color>
25+
<Color x:Key="CalciteBrandHoverColor" >#7938B6</Color>
26+
<Color x:Key="CalciteBrandPressColor" >#652E98</Color>
27+
</ResourceDictionary>
28+
<ResourceDictionary x:Key="Dark">
29+
<Color x:Key="CalciteBrandColor" >#7938B6</Color>
30+
<Color x:Key="CalciteBrandHoverColor" >#652E98</Color>
31+
<Color x:Key="CalciteBrandPressColor" >#51247A</Color>
32+
</ResourceDictionary>
33+
</ResourceDictionary.ThemeDictionaries>
34+
<SolidColorBrush x:Key="CalciteBrandBrush" Color="{ThemeResource CalciteBrandColor}" />
35+
<SolidColorBrush x:Key="CalciteBrandHoverBrush" Color="{ThemeResource CalciteBrandHoverColor}" />
36+
<SolidColorBrush x:Key="CalciteBrandPressColor" Color="{ThemeResource CalciteBrandPressColor}" />
37+
</ResourceDictionary>
838
<ResourceDictionary Source="Resources/Styles.xaml" />
9-
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
1039
</ResourceDictionary.MergedDictionaries>
40+
1141
<!-- Other app resources here -->
1242
<x:Double x:Key="ContentDialogMaxWidth">800</x:Double>
1343
<x:Double x:Key="ContentDialogMaxHeight">756</x:Double>

src/WinUI/ArcGIS.WinUI.Viewer/ArcGIS.WinUI.Viewer.csproj

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
</Content>
4747
</ItemGroup>
4848
<ItemGroup>
49-
<None Remove="Resources\Fonts\calcite-ui-icons-24.ttf" />
5049
<None Remove="Resources\github-mark.png" />
5150
<None Remove="ScreenshotTab.xaml" />
5251
</ItemGroup>
@@ -62,6 +61,7 @@
6261
<ItemGroup>
6362
<PackageReference Include="Esri.ArcGISRuntime.Hydrography" />
6463
<PackageReference Include="Esri.ArcGISRuntime.WinUI" />
64+
<PackageReference Include="Esri.Calcite.WinUI" />
6565
<PackageReference Include="System.Drawing.Common" />
6666
<PackageReference Include="System.Security.Cryptography.ProtectedData" />
6767
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" />
@@ -81,12 +81,6 @@
8181
</Compile>
8282
</ItemGroup>
8383

84-
<ItemGroup>
85-
<Content Include="Resources\Fonts\calcite-ui-icons-24.ttf">
86-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
87-
</Content>
88-
</ItemGroup>
89-
9084
<ItemGroup>
9185
<EmbeddedResource Include="Assets\github-mark.png" />
9286
</ItemGroup>

src/WinUI/ArcGIS.WinUI.Viewer/Converters/DirectionPointTypeToIconConverter.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
using Microsoft.UI.Xaml.Data;
22
using System;
33
using System.Collections.Generic;
4+
using Esri.Calcite.WinUI;
5+
46
namespace ArcGIS.WinUI.Viewer.Converters
57
{
68
internal class DirectionPointTypeToIconConverter : IValueConverter
79
{
810
// Create a dictionary of direction point type and corresponding icons.
9-
private Dictionary<int, string> _directionIcons = new()
11+
private Dictionary<int, char> _directionIcons = new()
1012
{
11-
{51, "\xe259"}, {52, "\xe2aa"}, {301, "\xe124"}, {200, "\xe122"}, {305, "\xe24e"},
12-
{205, "\xe199"}, {50, "\xe25a"}
13+
{51, (char)CalciteIcon.RouteFrom}, {52, (char)CalciteIcon.Straight}, {301, (char)CalciteIcon.ForkRight}, {200, (char)CalciteIcon.ForkLeft}, {305, (char)CalciteIcon.Right},
14+
{205, (char)CalciteIcon.Left}, {50, (char)CalciteIcon.RouteTo}
1315
};
1416

1517
public object Convert(object value, Type targetType, object parameter, string language)
@@ -22,4 +24,4 @@ public object ConvertBack(object value, Type targetType, object parameter, strin
2224
throw new NotImplementedException();
2325
}
2426
}
25-
}
27+
}

src/WinUI/ArcGIS.WinUI.Viewer/MainPage.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
xmlns:arcgisruntime="using:ArcGIS"
55
xmlns:models="using:ArcGIS.Samples.Shared.Models"
66
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
7-
xmlns:viewer="using:ArcGIS.WinUI.Viewer">
7+
xmlns:viewer="using:ArcGIS.WinUI.Viewer"
8+
xmlns:cal="using:Esri.Calcite.WinUI">
89
<Page.Resources>
910
<DataTemplate x:Key="StandardSampleItemTemplate">
1011
<Border Margin="1"
@@ -104,7 +105,7 @@
104105
Background="Transparent"
105106
BorderBrush="Transparent"
106107
Click="Settings_Click">
107-
<SymbolIcon RequestedTheme="Dark" Symbol="Setting" />
108+
<cal:SymbolIcon Symbol="Gear" IconScale="Medium" RequestedTheme="Dark" />
108109
</Button>
109110

110111
<Button Grid.Column="3"
@@ -116,9 +117,8 @@
116117
Background="Transparent"
117118
Click="Feedback_Click"
118119
BorderBrush="Transparent">
119-
<Path Data="M18 10H7V9h11v1zm0 2H7v1h11v-1zm-1 3H7v1h10v-1zm-4 3H7v1h6v-1zm8-15v10.19c-.23.21-.54.51-1 .97V4h-1V3h2zM5 22h7.73l-.41 1H4V3h2v1H5v18zm16-3.13V23h-4.14c.07-.05.06-.05 1.01-1H20v-2.13l1-1zM8.5 5.25v-3.5A.752.752 0 0 0 7.75 1a.752.752 0 0 0-.75.75v3.5c0 .412.338.75.75.75s.75-.338.75-.75zm3 0v-3.5a.752.752 0 0 0-.75-.75.752.752 0 0 0-.75.75v3.5c0 .412.338.75.75.75s.75-.338.75-.75zm3.5 0v-3.5a.752.752 0 0 0-.75-.75.752.752 0 0 0-.75.75v3.5c0 .412.338.75.75.75s.75-.338.75-.75zm3 0v-3.5a.752.752 0 0 0-.75-.75.752.752 0 0 0-.75.75v3.5c0 .412.338.75.75.75s.75-.338.75-.75zm3.435 11.772l-1.413-1.415-5.184 5.184 1.414 1.414 5.183-5.183zm1.725-2.05l-1.13-1.132a.2.2 0 0 0-.283 0l-.734.734 1.414 1.414.734-.734a.2.2 0 0 0 0-.283zm-9.32 6.941L13 24l2.086-.84-1.247-1.247z" Fill="White" />
120+
<cal:SymbolIcon Symbol="NotepadEdit" IconScale="Medium" RequestedTheme="Dark" />
120121
</Button>
121-
122122
</Grid>
123123

124124
<!--
Binary file not shown.

src/WinUI/ArcGIS.WinUI.Viewer/Resources/Styles.xaml

Lines changed: 2 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,7 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
22

3-
<Style x:Key="GeneralButtonStyle" TargetType="Button">
4-
<Setter Property="FontSize" Value="20" />
5-
<Setter Property="MinHeight" Value="48" />
6-
<Setter Property="MinWidth" Value="48" />
7-
<Setter Property="Margin" Value="0" />
8-
<Setter Property="Padding" Value="0" />
9-
<Setter Property="HorizontalAlignment" Value="Left" />
10-
<Setter Property="VerticalAlignment" Value="Top" />
11-
<Setter Property="HorizontalContentAlignment" Value="Center" />
12-
<Setter Property="VerticalContentAlignment" Value="Center" />
13-
<Setter Property="Background" Value="Transparent" />
14-
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}" />
15-
<Setter Property="AutomationProperties.Name" Value="Menu" />
16-
<Setter Property="UseSystemFocusVisuals" Value="True" />
17-
<Setter Property="Template">
18-
<Setter.Value>
19-
<ControlTemplate TargetType="Button">
20-
<Grid x:Name="LayoutRoot" Background="{TemplateBinding Background}">
21-
<ContentPresenter x:Name="ContentPresenter"
22-
Margin="{TemplateBinding Padding}"
23-
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
24-
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
25-
AutomationProperties.AccessibilityView="Raw"
26-
Content="{TemplateBinding Content}" />
27-
<VisualStateManager.VisualStateGroups>
28-
<VisualStateGroup x:Name="CommonStates">
29-
<VisualState x:Name="Normal" />
30-
<VisualState x:Name="PointerOver">
31-
<Storyboard>
32-
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(Grid.Background)">
33-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListLowBrush}" />
34-
</ObjectAnimationUsingKeyFrames>
35-
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
36-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
37-
</ObjectAnimationUsingKeyFrames>
38-
</Storyboard>
39-
</VisualState>
40-
<VisualState x:Name="Pressed">
41-
<Storyboard>
42-
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(Grid.Background)">
43-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightListMediumBrush}" />
44-
</ObjectAnimationUsingKeyFrames>
45-
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="Foreground">
46-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}" />
47-
</ObjectAnimationUsingKeyFrames>
48-
</Storyboard>
49-
</VisualState>
50-
<VisualState x:Name="Disabled">
51-
<Storyboard>
52-
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(TextBlock.Foreground)">
53-
<DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseLowBrush}" />
54-
</ObjectAnimationUsingKeyFrames>
55-
</Storyboard>
56-
</VisualState>
57-
</VisualStateGroup>
58-
</VisualStateManager.VisualStateGroups>
59-
</Grid>
60-
</ControlTemplate>
61-
</Setter.Value>
62-
</Setter>
63-
</Style>
3+
<x:Double x:Key="BodyTextBlockFontSize">14</x:Double>
4+
<x:Double x:Key="ControlContentThemeFontSize">14</x:Double>
645

656
<Style x:Key="BorderStyle" TargetType="Border">
667
<Setter Property="HorizontalAlignment" Value="Right" />

src/WinUI/ArcGIS.WinUI.Viewer/Samples/Analysis/ViewshedLocation/ViewshedLocation.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Setter Property="VerticalAlignment" Value="Center" />
99
<Setter Property="Margin" Value="0,0,5,10" />
1010
</Style>
11-
<Style TargetType="Slider">
11+
<Style TargetType="Slider" BasedOn="{StaticResource DefaultSliderStyle}">
1212
<Setter Property="HorizontalAlignment" Value="Stretch" />
1313
<Setter Property="VerticalAlignment" Value="Center" />
1414
<Setter Property="SnapsTo" Value="StepValues" />

src/WinUI/ArcGIS.WinUI.Viewer/Samples/Data/CreateKmlMultiTrack/CreateKmlMultiTrack.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<UserControl.Resources>
77
<Style x:Key="IconStyle" TargetType="Button">
88
<Style.Setters>
9-
<Setter Property="FontFamily" Value="/Resources/Fonts/calcite-ui-icons-24.ttf#calcite-ui-icons-24" />
10-
<Setter Property="FontSize" Value="25" />
9+
<Setter Property="FontFamily" Value="{StaticResource CalciteUIIconsMediumFontFamily}" />
10+
<Setter Property="FontSize" Value="24" />
1111
<Setter Property="HorizontalAlignment" Value="Stretch" />
1212
<Setter Property="Margin" Value="5" />
1313
<Setter Property="CornerRadius" Value="5" />
@@ -29,7 +29,7 @@
2929
</Grid.ColumnDefinitions>
3030
<Button x:Name="RecenterButton"
3131
Click="RecenterButton_Click"
32-
Content="&#xe13c;"
32+
Content="{StaticResource CalciteUIIcons_Glyph_GpsOn}"
3333
IsEnabled="False"
3434
Style="{StaticResource IconStyle}"
3535
ToolTipService.ToolTip="Recenter" />
@@ -43,7 +43,7 @@
4343
<Button x:Name="SaveButton"
4444
Grid.Column="2"
4545
Click="SaveButton_Click"
46-
Content="&#xe262;"
46+
Content="{StaticResource CalciteUIIcons_Glyph_Save}"
4747
IsEnabled="False"
4848
Style="{StaticResource IconStyle}"
4949
ToolTipService.ToolTip="Save" />
@@ -66,7 +66,7 @@
6666
SelectionChanged="TracksComboBox_SelectionChanged" />
6767
<Button Grid.Column="1"
6868
Click="ResetButton_Click"
69-
Content="&#xe243;"
69+
Content="{StaticResource CalciteUIIcons_Glyph_Reset}"
7070
Style="{StaticResource IconStyle}"
7171
ToolTipService.ToolTip="Reset" />
7272
</Grid>

0 commit comments

Comments
 (0)