File tree Expand file tree Collapse file tree 3 files changed +45
-1
lines changed
Uno.UI.Tests/Windows_UI_Xaml_Markup/XamlReaderTests Expand file tree Collapse file tree 3 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -726,6 +726,13 @@ public void When_IList_TabView()
726
726
Assert . AreEqual ( 2 , tabView1 . TabItems . Count ) ;
727
727
}
728
728
729
+ [ TestMethod ]
730
+ public void When_StateTrigger_PropertyPath ( )
731
+ {
732
+ var s = GetContent ( nameof ( When_StateTrigger_PropertyPath ) ) ;
733
+ var r = Windows . UI . Xaml . Markup . XamlReader . Load ( s ) as UserControl ;
734
+ }
735
+
729
736
private string GetContent ( string testName )
730
737
{
731
738
var assembly = this . GetType ( ) . Assembly ;
Original file line number Diff line number Diff line change
1
+ <UserControl
2
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
+ >
5
+ <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
6
+ <VisualStateManager.VisualStateGroups>
7
+ <VisualStateGroup>
8
+ <VisualState>
9
+ <VisualState.StateTriggers>
10
+ <!--VisualState to be triggered when window width is >=720 effective pixels.-->
11
+ <StateTrigger IsActive="True"/>
12
+ </VisualState.StateTriggers>
13
+ <VisualState.Setters>
14
+ <Setter Target="myPanel.Orientation" Value="Horizontal"/>
15
+ </VisualState.Setters>
16
+ </VisualState>
17
+ </VisualStateGroup>
18
+ </VisualStateManager.VisualStateGroups>
19
+ <StackPanel x:Name="myPanel" Orientation="Vertical">
20
+ <TextBlock Text="This is a block of text. It is text block 1. "
21
+ Style="{ThemeResource BodyTextBlockStyle}"/>
22
+ <TextBlock Text="This is a block of text. It is text block 2. "
23
+ Style="{ThemeResource BodyTextBlockStyle}"/>
24
+ <TextBlock Text="This is a block of text. It is text block 3. "
25
+ Style="{ThemeResource BodyTextBlockStyle}"/>
26
+ </StackPanel>
27
+ </Grid>
28
+ </UserControl>
Original file line number Diff line number Diff line change @@ -10,22 +10,31 @@ namespace Windows.UI.Xaml
10
10
{
11
11
public sealed partial class TargetPropertyPath
12
12
{
13
+ #if UNO_HAS_UIELEMENT_IMPLICIT_PINNING
13
14
private ManagedWeakReference ? _targetRef ;
15
+ #endif
14
16
15
17
public object ? Target
16
18
{
19
+ #if UNO_HAS_UIELEMENT_IMPLICIT_PINNING
17
20
get => _targetRef ? . Target ;
18
21
set
19
22
{
20
23
if ( _targetRef != null )
21
24
{
22
25
WeakReferencePool . ReturnWeakReference ( this , _targetRef ) ;
26
+ _targetRef = null ;
23
27
}
24
- else
28
+
29
+ if ( ! ( value is null ) )
25
30
{
26
31
_targetRef = WeakReferencePool . RentWeakReference ( this , value ) ;
27
32
}
28
33
}
34
+ #else
35
+ get ;
36
+ set ;
37
+ #endif
29
38
}
30
39
31
40
public PropertyPath ? Path
You can’t perform that action at this time.
0 commit comments