Skip to content
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@
"9d2987a825c646468b3ce7512fb76e2d"
],
"redirect_from": [
"/net/latest/wpf/sample-code/configure-electronic-navigational-charts.htm",
"net/latest/wpf/sample-code/select-enc-features.htm",
"net/latest/wpf/sample-code/change-enc-display-settings.htm",
"net/latest/wpf/sample-code/add-enc-exchange-set.htm"
"/net/latest/maui/sample-code/configure-electronic-navigational-charts.htm"
Comment thread
duffh marked this conversation as resolved.
Outdated
],
"relevant_apis": [
"EncCell",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="ArcGIS.Samples.SnapGeometryEditsWithUtilityNetworkRules.SnapGeometryEditsWithUtilityNetworkRules"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:converters="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Maui;assembly=Esri.ArcGISRuntime.Maui">
<ContentPage.Resources>
<DataTemplate x:Key="SnapSettingTemplate">
<Grid ColumnDefinitions="auto,130,*" ColumnSpacing="10">
<Image Grid.Column="0"
HeightRequest="15"
HorizontalOptions="Start"
Source="{Binding Path=Symbol}"
VerticalOptions="Center"
WidthRequest="15" />
<Label Grid.Column="1"
Text="{Binding Path=Name}"
VerticalOptions="Center" />
<CheckBox Grid.Column="2"
IsChecked="{Binding Path=SnapSourceSettings.IsEnabled}"
VerticalOptions="Center" />
</Grid>
</DataTemplate>
<Style x:Key="IconStyle" TargetType="Button">
<Style.Setters>
<Setter Property="FontFamily" Value="calcite-ui-icons-24" />
<Setter Property="FontSize" Value="25" />
<Setter Property="BackgroundColor" Value="{AppThemeBinding Dark=#3C3C3C, Light=White}" />
</Style.Setters>
</Style>
<converters:InvertedBoolConverter x:Key="InvertedBoolConverter" />
</ContentPage.Resources>
<Grid>
<esriUI:MapView x:Name="MyMapView" GeoViewTapped="MyMapView_GeoViewTapped" />
<Border x:Name="SnappingControls"
Margin="10"
HorizontalOptions="End"
IsVisible="False"
StrokeThickness="0"
VerticalOptions="Start"
WidthRequest="250">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackLayout Grid.Row="0"
Orientation="Vertical"
Spacing="5">
<Border Background="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Dark}}" StrokeThickness="0">
<Border.StrokeShape>
<RoundRectangle CornerRadius="5" />
</Border.StrokeShape>
<StackLayout>
<Label x:Name="InstructionsLabel"
Padding="10"
FontSize="14"
Text="Tap a point feature to edit." />
</StackLayout>
</Border>
<StackLayout x:Name="SelectedFeaturePanel"
IsVisible="False"
Spacing="5">
<Border Padding="10"
Background="{AppThemeBinding Light={StaticResource White},
Dark={StaticResource Dark}}"
StrokeThickness="0">
<Border.StrokeShape>
<RoundRectangle CornerRadius="5" />
</Border.StrokeShape>
<StackLayout>
<Label Margin="0,0,0,5"
FontAttributes="Bold"
FontSize="14"
Text="Feature selected" />
<Grid RowSpacing="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Label Grid.Row="0"
Grid.Column="0"
Margin="0,0,5,0"
Text="AssetGroup:" />
<Label x:Name="SelectedAssetGroupLabel"
Grid.Row="0"
Grid.Column="1" />
<Label Grid.Row="1"
Grid.Column="0"
Margin="0,0,5,0"
Text="AssetType:" />
<Label x:Name="SelectedAssetTypeLabel"
Grid.Row="1"
Grid.Column="1" />
</Grid>
</StackLayout>
</Border>
<Button x:Name="SnapSourcesButton"
Clicked="SnapSourcesButton_Clicked"
Text="Snap sources" />
<Button x:Name="GeometryEditorButton"
Clicked="GeometryEditorButton_Click"
IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}, Converter={StaticResource InvertedBoolConverter}}"
Text="Start editor" />
<Grid ColumnSpacing="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
Clicked="DiscardButton_Click"
IsEnabled="{Binding GeometryEditor.IsStarted, Source={x:Reference MyMapView}}"
Style="{StaticResource IconStyle}"
Text="&#xe080;"
ToolTipProperties.Text="Discard edits" />
<Button x:Name="SaveButton"
Grid.Column="1"
Clicked="SaveButton_Click"
IsEnabled="{Binding GeometryEditor.CanUndo, Source={x:Reference MyMapView}}"
Style="{StaticResource IconStyle}"
Text="&#xe06f;"
ToolTipProperties.Text="Save edits" />
</Grid>
</StackLayout>
</StackLayout>
</Grid>
</Border>
<Grid x:Name="SnapSourcesPopup"
Grid.ColumnSpan="2"
Padding="10"
Background="#AA333333"
IsVisible="False">
<Border Margin="10"
Background="{AppThemeBinding Dark=Black,
Light=White}"
HorizontalOptions="Center"
StrokeShape="RoundRectangle 10"
VerticalOptions="Center"
WidthRequest="300">
<Border.GestureRecognizers>
<TapGestureRecognizer />
</Border.GestureRecognizers>
<StackLayout Padding="10" Spacing="10">
<Label Padding="0,5"
FontAttributes="Bold"
FontSize="14"
Text="Snap sources" />
<CollectionView x:Name="SnapSourcesList"
Margin="15,0"
ItemTemplate="{StaticResource SnapSettingTemplate}" />
<Label FontAttributes="Bold"
FontSize="14"
Text="SnapRuleBehavior" />
<StackLayout Margin="20,0,0,0" Orientation="Horizontal">
<Rectangle Grid.Column="0"
Margin="0,0,5,0"
Fill="Green"
HeightRequest="10"
WidthRequest="10" />
<Label Text="None" />
</StackLayout>
<StackLayout Margin="20,0,0,0" Orientation="Horizontal">
<Rectangle Grid.Column="0"
Margin="0,0,5,0"
Fill="Orange"
HeightRequest="10"
WidthRequest="10" />
<Label Text="RulesLimitSnapping" />
</StackLayout>
<StackLayout Margin="20,0,0,0" Orientation="Horizontal">
<Rectangle Grid.Column="0"
Margin="0,0,5,0"
Fill="Red"
HeightRequest="10"
WidthRequest="10" />
<Label Text="RulesPreventSnapping" />
</StackLayout>
<Button Clicked="SnapSourcesButton_Clicked" Text="Close" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your choice, but I think this button could be removed. A tap gesture recognizer when tapping a semitransparent border would work since you're following the popup UI pattern, alike the TakeScreenshot MAUI sample.

Copy link
Copy Markdown
Collaborator Author

@duffh duffh Mar 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about using a tap gesture recognizer here as well, I tried with and without and I think I prefer the button in this case. Mostly because we don't need a scroll view here so it's easy to see the snap sources and the close button all together.

If you're happy I'll leave it in.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed my mind and removed it 👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ui bug

My apologies, the TakeScreenshot sample wasn't a great example since tapping anywhere on screen closes the screenshot "popup". Tapping anywhere in the popup, say the snap source checkbox shouldn't close the popup automatically. But tapping the greyed out GeoView should close out the popup. DisplayGrid is a better sample of what I meant by the popup UI pattern.

AUsHWPooVo

The problem was the grid with the greyed out the semitransparent background was the parent of the popup, so tapping the popup was also tapping the grid due to inheritance. I went ahead and separated the popup background from the actual popup (indention is why the diff is large, did not make any other edits).

commit: 6fbb6b1

</StackLayout>
</Border>
</Grid>
</Grid>
</ContentPage>
Loading