Skip to content

Commit 39cdb08

Browse files
authored
Merge pull request #458 from trimble-oss/452-memory-leakage-on-modus-controls
Dropdown popup is not opening in .net 10 #457
2 parents 8832141 + 8599a70 commit 39cdb08

4 files changed

Lines changed: 20 additions & 9 deletions

File tree

Trimble.Modus.Components/Controls/DropDown/DropDownContents.xaml.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,18 @@ internal DropDownContents(View anchorView, Enums.ModalPosition position) : base(
3939
public Thickness Margin { get; set; }
4040
public IEnumerable ItemSource { get; set; }
4141
public double DesiredHeight { get; set; }
42+
public double DesiredWidth { get; set; }
4243
public EventHandler<SelectedItemChangedEventArgs> SelectedEventHandler { get; set; }
4344
public int SelectedIndex { get; set; }
4445
public double YPosition { get; set; }
4546
public new double Height { get; set; }
46-
47+
public Action ChangeIndicatorWhenPopupRemove { get; set; }
4748
public void Build()
4849
{
4950
Animation = new RevealAnimation(DesiredHeight);
5051
border.Margin = Margin;
5152
border.HeightRequest = DesiredHeight;
52-
border.WidthRequest = WidthRequest;
53+
border.WidthRequest = DesiredWidth;
5354
listView.ItemsSource = ItemSource;
5455
if (SelectedIndex < 0)
5556
{
@@ -70,7 +71,11 @@ public void Build()
7071
#endif
7172
}
7273
}
73-
74+
protected override void OnDisappearing()
75+
{
76+
base.OnDisappearing();
77+
ChangeIndicatorWhenPopupRemove?.Invoke();
78+
}
7479
private static void UpdateBackgroundColorOfCell(ListView listView)
7580
{
7681
if (listView.SelectedItem != null)

Trimble.Modus.Components/Controls/DropDown/TMDropDown.xaml.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,11 @@ private async void Open()
244244
SelectedItem = this.SelectedItem,
245245
Margin = margin,
246246
DesiredHeight = desiredHeight,
247-
WidthRequest = innerBorder.Width,
247+
DesiredWidth = innerBorder.Width,
248248
SelectedEventHandler = OnSelected,
249249
YPosition = loc.Y,
250-
Height = height
250+
Height = height,
251+
ChangeIndicatorWhenPopupRemove = OnPopupRemoved
251252
};
252253
dropDownContents.Build();
253254
await Task.WhenAll(
@@ -260,7 +261,7 @@ await Task.WhenAll(
260261
}
261262
}
262263

263-
private void OnPopupRemoved(object sender, EventArgs e)
264+
private void OnPopupRemoved()
264265
{
265266
Close();
266267
}
@@ -383,7 +384,12 @@ public void Dispose()
383384
SelectionChanged = null;
384385
SelectionChangedCommand = null;
385386
ItemsSource = null;
386-
dropDownContents = null;
387+
if (dropDownContents != null)
388+
{
389+
dropDownContents.ChangeIndicatorWhenPopupRemove = null;
390+
dropDownContents = null;
391+
}
387392
previousSelection = null;
393+
388394
}
389395
}

Trimble.Modus.Components/Controls/Popup/Animations/RevealAnimation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public override void Preparing(View content, PopupPage page)
1919
if (HasBackgroundAnimation)
2020
{
2121
_defaultOpacity = page.Opacity;
22-
page.HeightRequest = 0;
22+
//page.HeightRequest = 0;
2323
}
2424
else if (content != null)
2525
{

Trimble.Modus.Components/Trimble.Modus.Components.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
2828
<PackageId>Trimble.Modus.Components</PackageId>
2929
<Title>Trimble Modus</Title>
30-
<Version>1.4.0.2</Version>
30+
<Version>1.4.0.3</Version>
3131
<Authors>Trimble Inc</Authors>
3232
<Company>Trimble Inc</Company>
3333
<Product>Trimble.Modus.Components</Product>

0 commit comments

Comments
 (0)