Skip to content

Commit 1ba5f28

Browse files
Merge pull request #63 from TheEightBot/develop
2 parents 1bb3598 + c112b48 commit 1ba5f28

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

AuroraControls.TestApp/ChipGroupPage.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@
199199
AllowMultipleSelection="{Binding AllowMultipleSelection}"
200200
HorizontalSpacing="{Binding HorizontalSpacing}"
201201
VerticalSpacing="{Binding VerticalSpacing}"
202+
ChipInset="64"
202203
ItemsSource="{Binding ChipItems}"
203204
ItemTemplate="{StaticResource ChipTemplate}"
204205
SelectedValue="{Binding SelectedValue, Mode=TwoWay}"

AuroraControlsMaui/ChipGroup.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,22 @@ public double VerticalSpacing
122122
set => SetValue(VerticalSpacingProperty, value);
123123
}
124124

125+
/// <summary>
126+
/// The start offset to insert empty space before the first chip.
127+
/// </summary>
128+
public static readonly BindableProperty ChipInsetProperty =
129+
BindableProperty.Create(nameof(ChipInset), typeof(double), typeof(ChipGroup), 0.0,
130+
propertyChanged: OnLayoutPropertyChanged);
131+
132+
/// <summary>
133+
/// Gets or sets the start offset to insert empty space before the first chip.
134+
/// </summary>
135+
public double ChipInset
136+
{
137+
get => (double)GetValue(ChipInsetProperty);
138+
set => SetValue(ChipInsetProperty, value);
139+
}
140+
125141
/// <summary>
126142
/// The source collection of items to create chips from.
127143
/// </summary>
@@ -278,6 +294,8 @@ private void InitializeLayout()
278294
AlignItems = FlexAlignItems.Center,
279295
};
280296

297+
ApplyChipInset();
298+
281299
if (IsScrollable)
282300
{
283301
_scrollView = new ScrollView
@@ -319,6 +337,20 @@ private void UpdateSpacing()
319337
}
320338
}
321339

340+
private void ApplyChipInset()
341+
{
342+
if (_chipContainer == null)
343+
{
344+
return;
345+
}
346+
347+
// Apply inner padding if specified
348+
if (this.ChipInset > 0)
349+
{
350+
_chipContainer.Padding = new Thickness(this.ChipInset, 0);
351+
}
352+
}
353+
322354
/// <summary>
323355
/// Handles changes to the AllowMultipleSelection property.
324356
/// Updates chip configurations and selection state.
@@ -898,6 +930,8 @@ private void UpdateLayout()
898930
// Update container orientation and wrapping behavior
899931
_chipContainer.Wrap = IsScrollable ? FlexWrap.NoWrap : FlexWrap.Wrap;
900932

933+
ApplyChipInset();
934+
901935
// Remove or add scrollview as needed
902936
if (IsScrollable && Content != _scrollView)
903937
{

0 commit comments

Comments
 (0)