Skip to content

Commit

Permalink
Ensure properties are preserved after trimming (#532)
Browse files Browse the repository at this point in the history
The analyzer can't see these are used by bindings and would get trimmed away.
  • Loading branch information
dotMorten authored Nov 28, 2023
1 parent 3aa04c0 commit 8b36773
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ public AttachmentsPopupElementView()
{
#if MAUI
ControlTemplate = DefaultControlTemplate;
// Ensure bound properties aren't trimmed:
_ = Element?.Title;
_ = Element?.Description;
_ = Element?.Attachments;
#else
DefaultStyleKey = typeof(AttachmentsPopupElementView);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public MediaPopupElementView()
{
#if MAUI
ControlTemplate = DefaultControlTemplate;
// Ensure bound properties aren't trimmed:
_ = Element?.Title;
_ = Element?.Description;
var m = Element?.Media?.FirstOrDefault();
_ = m?.Title;
_ = m?.Caption;
#else
DefaultStyleKey = typeof(MediaPopupElementView);
#endif
Expand Down
3 changes: 3 additions & 0 deletions src/Toolkit/Toolkit/UI/Controls/PopupViewer/PopupViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ public PopupViewer()
{
#if MAUI
ControlTemplate = DefaultControlTemplate;
// Ensure bound properties aren't trimmed:
_ = Popup?.Title;
_ = Popup?.EvaluatedElements;
#else
DefaultStyleKey = typeof(PopupViewer);
#endif
Expand Down

0 comments on commit 8b36773

Please sign in to comment.