Skip to content

Commit 4f18244

Browse files
authored
[WPF] Calcite integration (#1680)
1 parent 2f5fdb4 commit 4f18244

File tree

39 files changed

+330
-398
lines changed

39 files changed

+330
-398
lines changed

src/Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<PackageVersion Include="Esri.ArcGISRuntime.UWP" Version="$(ArcGISMapsSDKVersion)" />
1616
<PackageVersion Include="Esri.ArcGISRuntime.Toolkit.UWP" Version="$(ArcGISMapsSDKVersion)" />
1717
<PackageVersion Include="Esri.ArcGISRuntime.Toolkit.WinUI" Version="$(ArcGISMapsSDKVersion)" />
18+
<PackageVersion Include="Esri.Calcite.WPF" Version="1.0.0-rc.1" />
1819
<PackageVersion Include="Esri.Calcite.Maui" Version="1.0.0-rc.1" />
1920
<PackageVersion Include="Esri.Calcite.WinUI" Version="1.0.0-rc.1" />
2021
<PackageVersion Include="Markdig" Version="0.37.0" />
Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,44 @@
11
<UserControl x:Class="ArcGIS.ApiKeyPrompt"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
Width="500"
5-
Height="220">
6-
<StackPanel Orientation="Vertical">
7-
<TextBlock x:Name="Instructions"
8-
Margin="5"
9-
TextWrapping="Wrap">
10-
Some content used in the samples requires an API key to access ArcGIS location services. Go to <Hyperlink NavigateUri="https://links.esri.com/create-an-api-key" RequestNavigate="Hyperlink_RequestNavigate">
11-
the developer documentation tutorial
12-
</Hyperlink>
13-
to create a new API key.</TextBlock>
14-
<TextBlock Margin="5" TextWrapping="Wrap" Text="Ensure that your API key privileges include basemaps, geocoding and routing services to run all samples." />
15-
<StackPanel Orientation="Horizontal">
16-
<Label Content="Current Api Key:" />
17-
<TextBox x:Name="CurrentKeyText"
18-
Width="375"
19-
Margin="5,0,0,0"
20-
HorizontalScrollBarVisibility="Visible"
21-
IsReadOnly="True" />
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
4+
<ScrollViewer>
5+
<StackPanel Orientation="Vertical">
6+
<TextBlock x:Name="Instructions"
7+
Margin="5"
8+
TextWrapping="Wrap">
9+
Some content used in the samples requires an API key to access ArcGIS location services. Go to <Hyperlink NavigateUri="https://links.esri.com/create-an-api-key" RequestNavigate="Hyperlink_RequestNavigate">
10+
the developer documentation tutorial
11+
</Hyperlink>
12+
to create a new API key.</TextBlock>
13+
<TextBlock Margin="5" TextWrapping="Wrap" Text="Ensure that your API key privileges include basemaps, geocoding and routing services to run all samples." />
14+
<StackPanel Orientation="Horizontal">
15+
<Label Content="Current Api Key:" />
16+
<TextBox x:Name="CurrentKeyText"
17+
Width="375"
18+
Margin="5,0,0,0"
19+
HorizontalScrollBarVisibility="Visible"
20+
IsReadOnly="True" />
21+
</StackPanel>
22+
<TextBox x:Name="KeyEntryBox"
23+
Width="475"
24+
Height="35"
25+
Margin="5"
26+
HorizontalAlignment="Left"
27+
HorizontalScrollBarVisibility="Auto"
28+
Text="" />
29+
<StackPanel Orientation="Horizontal">
30+
<Button x:Name="SetKeyButton"
31+
Margin="5"
32+
Style="{StaticResource CalciteSecondaryButtonStyle}"
33+
Click="SetKeyButton_Click"
34+
Content="Set API key" />
35+
<Button x:Name="DeleteKeyButton"
36+
Margin="5"
37+
Style="{StaticResource CalciteDangerSecondaryButtonStyle}"
38+
Click="DeleteKeyButton_Click"
39+
Content="Delete API key" />
40+
</StackPanel>
41+
<TextBlock x:Name="Status" Margin="5,0,0,0" />
2242
</StackPanel>
23-
<TextBox x:Name="KeyEntryBox"
24-
Width="475"
25-
Height="35"
26-
Margin="5"
27-
HorizontalAlignment="Left"
28-
HorizontalScrollBarVisibility="Auto"
29-
Text="" />
30-
<StackPanel Orientation="Horizontal">
31-
<Button x:Name="SetKeyButton"
32-
Margin="5"
33-
Click="SetKeyButton_Click"
34-
Content="Set API key" />
35-
<Button x:Name="DeleteKeyButton"
36-
Margin="5"
37-
Click="DeleteKeyButton_Click"
38-
Content="Delete API key" />
39-
</StackPanel>
40-
<TextBlock x:Name="Status" Margin="5,0,0,0" />
41-
</StackPanel>
43+
</ScrollViewer>
4244
</UserControl>

src/WPF/WPF.Viewer/App.xaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111
<!-- General Style files -->
1212
<ResourceDictionary.MergedDictionaries>
1313
<ResourceDictionary Source="Resources\ControlStyles.xaml" />
14+
<CalciteResources xmlns="http://schemas.esri.com/calcite/2024" Theme="Light" />
15+
<ResourceDictionary>
16+
<!-- Overriding brand brushes: -->
17+
<Color x:Key="CalciteBrandColor" >#7938B6</Color>
18+
<Color x:Key="CalciteBrandHoverColor" >#652E98</Color>
19+
<Color x:Key="CalciteBrandPressColor" >#51247A</Color>
20+
<Color x:Key="CalciteBrandUnderlineColor">#7938B6</Color>
21+
</ResourceDictionary>
1422
</ResourceDictionary.MergedDictionaries>
1523

1624
<Style x:Key="HeaderTextBlock" TargetType="TextBlock">

src/WPF/WPF.Viewer/ArcGIS.WPF.Viewer.Net.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
<Resource Include="Assets\**\*.ico" />
3535
<EmbeddedResource Include="Resources\PictureMarkerSymbols\*.png" />
3636
<Resource Include="Resources\*.png" />
37-
<Resource Include="Resources\Fonts\calcite-ui-icons-24.ttf">
38-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
39-
</Resource>
4037
<Content Include="Samples\**\*.jpg">
4138
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
4239
</Content>
@@ -63,6 +60,7 @@
6360
<PackageReference Include="Esri.ArcGISRuntime.LocalServices" />
6461
<PackageReference Include="Esri.ArcGISRuntime.Toolkit.WPF" />
6562
<PackageReference Include="Esri.ArcGISRuntime.WPF" />
63+
<PackageReference Include="Esri.Calcite.WPF" />
6664
<PackageReference Include="Markdig" />
6765
<PackageReference Include="Microsoft.Web.WebView2" />
6866
<PackageReference Include="System.Speech" />

src/WPF/WPF.Viewer/Controls/SearchTextBox.xaml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<UserControl x:Class="ArcGIS.Controls.SearchTextBox"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:calcite="http://schemas.esri.com/calcite/2024">
45
<Grid>
56
<TextBox x:Name="SearchBox"
67
Width="250"
@@ -30,17 +31,17 @@
3031
BorderBrush="Transparent"
3132
Click="Clear_Clicked"
3233
Visibility="Collapsed">
33-
<Image MaxWidth="16"
34-
MaxHeight="16"
35-
Source="../Resources/ic_menu_closeclear_light.png" />
34+
<Path Data="{calcite:CalciteIconGeometry Icon=X, Scale=Small}"
35+
Fill="{DynamicResource CalciteText2Brush}"
36+
Width="10" Height="10"
37+
Stretch="Uniform" />
3638
</Button>
37-
<Image x:Name="SearchImage"
38-
MaxWidth="16"
39-
MaxHeight="16"
40-
Margin="5"
41-
HorizontalAlignment="Right"
42-
VerticalAlignment="Center"
43-
Source="../Resources/ic_menu_find_light.png"
44-
Visibility="Visible" />
39+
<Path x:Name="SearchImage"
40+
Data="{calcite:CalciteIconGeometry Icon=Search, Scale=Small}"
41+
Fill="{DynamicResource CalciteText2Brush}"
42+
HorizontalAlignment="Right"
43+
Margin="5"
44+
Width="16" Height="16"
45+
Stretch="Uniform" />
4546
</Grid>
4647
</UserControl>

src/WPF/WPF.Viewer/Converters/DirectionPointTypeToIconConverter.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
using System.Collections.Generic;
33
using System.Globalization;
44
using System.Windows.Data;
5+
using Esri.Calcite.WPF;
56

67
namespace ArcGIS.WPF.Viewer.Converters
78
{
89
internal class DirectionPointTypeToIconConverter : IValueConverter
910
{
1011
// Create a dictionary of direction point type and corresponding icons.
11-
private Dictionary<int, string> _directionIcons = new Dictionary<int, string>
12+
private Dictionary<int, char> _directionIcons = new Dictionary<int, char>
1213
{
13-
{51, "\xe259"}, {52, "\xe2aa"}, {301, "\xe124"}, {200, "\xe122"}, {305, "\xe24e"},
14-
{205, "\xe199"}, {50, "\xe25a"}
14+
{51, (char)CalciteIcon.RouteFrom}, {52, (char)CalciteIcon.Straight}, {301, (char)CalciteIcon.ForkRight}, {200, (char)CalciteIcon.ForkLeft}, {305, (char)CalciteIcon.Right},
15+
{205, (char)CalciteIcon.Left}, {50, (char)CalciteIcon.RouteTo}
1516
};
1617

1718
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)

src/WPF/WPF.Viewer/MainWindow.xaml

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:controls="clr-namespace:ArcGIS.Controls"
66
xmlns:converters="clr-namespace:ArcGIS.WPF.Viewer.Converters"
77
xmlns:local="clr-namespace:ArcGIS.WPF.Viewer"
8+
xmlns:calcite="http://schemas.esri.com/calcite/2024"
89
Title="ArcGIS Maps SDK for .NET Samples"
910
Icon="Assets/ApplicationIcons/windows-desktop-256.ico"
1011
WindowStartupLocation="CenterScreen"
@@ -36,10 +37,10 @@
3637
Click="SampleGridFavoriteButton_Click"
3738
CommandParameter="{Binding FormalName}"
3839
Style="{DynamicResource SampleGridFavoriteButton}">
39-
<Path
40-
Data="M15.633 6.718l-3.666 3.176 1.107 4.732a.632.632 0 0 1-.221.68.572.572 0 0 1-.34.11.72.72 0 0 1-.373-.111l-4.165-2.533-4.163 2.532a.607.607 0 0 1-.936-.676l1.107-4.734L.317 6.718a.633.633 0 0 1-.22-.68.63.63 0 0 1 .578-.418l4.824-.406 1.9-4.537a.619.619 0 0 1 1.154 0l1.898 4.537 4.824.406a.606.606 0 0 1 .358 1.098z"
41-
Fill="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}"
42-
Stroke="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}" />
40+
<Path Data="{calcite:CalciteIconGeometry Icon=StarFilled, Scale=Small}"
41+
Width="18" Height="18" Stretch="Uniform"
42+
Fill="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}"
43+
Stroke="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}" />
4344
</Button>
4445
<TextBlock
4546
Grid.Row="0"
@@ -144,10 +145,9 @@
144145
Background="Transparent"
145146
BorderBrush="Transparent"
146147
Click="SettingsButton_Click">
147-
<Image
148-
MaxWidth="24"
149-
MaxHeight="24"
150-
Source="Resources/ic_menu_settings_dark.png" />
148+
<Path Data="{calcite:CalciteIconGeometry Icon=Gear, Scale=Large}"
149+
Stroke="White"
150+
Width="22" Height="22" Stretch="Uniform" />
151151
</Button>
152152
<Button
153153
Grid.Column="3"
@@ -159,8 +159,9 @@
159159
Margin="5,5"
160160
VerticalAlignment="Center"
161161
Foreground="White">
162-
<Path Fill="White"
163-
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" />
162+
<Path Data="{calcite:CalciteIconGeometry Icon=NotePadEdit, Scale=Small}"
163+
Fill="White"
164+
Width="22" Height="22" Stretch="Uniform" />
164165
</Button>
165166
</Grid>
166167

@@ -175,7 +176,7 @@
175176
Padding="0,10,0,0"
176177
Background="#FFF8F8F8"
177178
BorderBrush="Transparent"
178-
FontSize="18"
179+
FontSize="16"
179180
ItemsSource="{Binding}"
180181
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
181182
SelectedItemChanged="categories_SelectedItemChanged"
@@ -216,14 +217,16 @@
216217
Height="25"
217218
Margin="5,5"
218219
VerticalAlignment="Center"
219-
Background="white"
220+
Foreground="White"
221+
Background="White"
220222
BorderThickness="0"
221223
Click="InSampleFavoriteButton_Click"
222-
CommandParameter="{Binding FormalName}">
223-
<Path
224-
Data="M15.633 6.718l-3.666 3.176 1.107 4.732a.632.632 0 0 1-.221.68.572.572 0 0 1-.34.11.72.72 0 0 1-.373-.111l-4.165-2.533-4.163 2.532a.607.607 0 0 1-.936-.676l1.107-4.734L.317 6.718a.633.633 0 0 1-.22-.68.63.63 0 0 1 .578-.418l4.824-.406 1.9-4.537a.619.619 0 0 1 1.154 0l1.898 4.537 4.824.406a.606.606 0 0 1 .358 1.098z"
225-
Fill="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}"
226-
Stroke="Black" />
224+
CommandParameter="{Binding FormalName}"
225+
Style="{x:Null}">
226+
<Path Data="{calcite:CalciteIconGeometry Icon=StarFilled, Scale=Small}"
227+
Stroke="Black"
228+
Fill="{Binding Foreground, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}}"
229+
Width="18" Height="18" Stretch="Uniform" />
227230
</Button>
228231
</StackPanel>
229232
<StackPanel Grid.Column="1" Orientation="Horizontal">
@@ -235,8 +238,11 @@
235238
Background="White"
236239
BorderThickness="0"
237240
Click="ScreenshotButton_Click"
238-
Visibility="Hidden">
239-
<Path Data="M14.5 8a4.5 4.5 0 1 0 4.5 4.5A4.505 4.505 0 0 0 14.5 8zm0 8a3.5 3.5 0 1 1 3.5-3.5 3.504 3.504 0 0 1-3.5 3.5zM8 9H4V8h4zm13 11H3a2.002 2.002 0 0 1-2-2V8a2.002 2.002 0 0 1 2-2h1V5h4v1h1.5a.5.5 0 0 0 .5-.5A1.502 1.502 0 0 1 11.5 4h6A1.502 1.502 0 0 1 19 5.5a.5.5 0 0 0 .5.5H21a2.002 2.002 0 0 1 2 2v10a2.002 2.002 0 0 1-2 2zM3 7a1.001 1.001 0 0 0-1 1v10a1.001 1.001 0 0 0 1 1h18a1.001 1.001 0 0 0 1-1V8a1.001 1.001 0 0 0-1-1h-1.5A1.502 1.502 0 0 1 18 5.5a.5.5 0 0 0-.5-.5h-6a.5.5 0 0 0-.5.5A1.502 1.502 0 0 1 9.5 7H7V6H5v1z" Stroke="Black" />
241+
Visibility="Hidden"
242+
Style="{x:Null}">
243+
<Path Data="{calcite:CalciteIconGeometry Icon=Camera, Scale=Large}"
244+
Stroke="Black"
245+
Width="22" Height="22" Stretch="Uniform" />
240246
</Button>
241247
<RadioButton
242248
x:Name="SampleRadTab"

0 commit comments

Comments
 (0)