我的代码背后有我想在 XAML 中设置的自定义属性。
财产:
Public Property WindowName() As String Implements IVendorEntryEditView.WindowName
Get
Return CType(GetValue(WindowNameProperty), Integer)
End Get
Set(ByVal value As String)
SetValue(WindowNameProperty, value)
End Set
End Property
Public Shared ReadOnly WindowNameProperty As DependencyProperty = _
DependencyProperty.Register("WindowName", GetType(String), GetType(VendorEntryEditView), _
New PropertyMetadata(""))
Attached property has no setter
但是,当我尝试设置它时,我在我的 XAML 中收到一条消息:
<UserControl x:Class="VendorEntryEditView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:EntryEditUi"
mc:Ignorable="d"
Loaded="VendorEntryEditView_OnLoaded"
local:VendorEntryEditView.WindowName="test"
d:DesignHeight="300" d:DesignWidth="300">
如何在 XAML 中设置该属性?谢谢!