Add x:Name property to custom control in VB project (#1340)

This commit is contained in:
Tris Shores
2022-03-24 13:33:08 -07:00
committed by GitHub
parent 03760a4124
commit 907918d922
2 changed files with 137 additions and 139 deletions
@@ -1,5 +1,5 @@
<Window x:Class="CodeSampleVb.MainWindow"
xmlns:local="clr-namespace:CodeSampleVb.CodeSampleVb"
<Window x:Class="MainWindow"
xmlns:local="clr-namespace:CodeSampleVb"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Property value inheritance" Height="200" Width="400" Background="Yellow">
@@ -18,7 +18,7 @@
</Canvas>
<!--</XamlElementTree>-->
<local:Canvas_AllowDropInheritDisabled Grid.Column="1" Margin="20" Background="Orange" AllowDrop="True">
<local:Canvas_AllowDropInheritDisabled x:Name="canvas11" Grid.Column="1" Margin="20" Background="Orange" AllowDrop="True">
<StackPanel Name="stackPanel11" Margin="20" Background="Green">
<Label Name="label11" Margin="20" Height="40" Width="40" Background="Blue"/>
</StackPanel>
@@ -1,5 +1,4 @@
Namespace CodeSampleVb
Partial Public Class MainWindow
Partial Public Class MainWindow
Inherits Window
Public Sub New()
@@ -28,7 +27,7 @@
CType(AllowDropProperty.
GetMetadata(GetType(Canvas_AllowDropInheritDisabled)), FrameworkPropertyMetadata)
Debug.Assert(fpm11.[Inherits] = False)
' Debug.Assert(canvas11.AllowDrop = True)
Debug.Assert(canvas11.AllowDrop = True)
Debug.Assert(stackPanel11.AllowDrop = False)
Debug.Assert(label11.AllowDrop = False)
End Sub
@@ -149,9 +148,9 @@
Debug.Assert(Canvas_IsTransparentInheritDisabled.GetIsTransparent(myCanvas6) = False)
End Sub
End Class
End Class
Public Class Canvas_AllowDropInheritDisabled
Public Class Canvas_AllowDropInheritDisabled
Inherits Canvas
Shared Sub New()
' Disable property value inheritance in a new property metadata object.
@@ -250,4 +249,3 @@
Public Class Canvas_IsTransparentInheritDisabled3
Inherits Canvas_IsTransparentInheritDisabled
End Class
End Namespace