-
March 21st, 2011, 09:52 AM
#1
user control - binding order problem ?
Hi,
I want to create a user telephone control in WPF.
I have tried many things but I can't seem to be able to pass a boolean dependency property. I think the problem has to do with the order in which the binding is processed.
Here is what I have:
user control telephone.xaml:
<telerik:RadMaskedTextBox
Name="mtbPhone"
MaskType="Standard"
..
Mask="{Binding ElementName=TelephoneControl, Path=PhoneMask}"
/>
user control telephone.xaml.vb:
Public Shared ReadOnly HasExtensionProperty As DependencyProperty = DependencyProperty.Register("HasExtension", GetType(Boolean), GetType(Telephone))
Public Property HasExtension() As Boolean
Get
Return CType(GetValue(HasExtensionProperty), Boolean)
End Get
Set(ByVal value As Boolean)
SetValue(HasExtensionProperty, value)
End Set
End Property
----
Public ReadOnly Property PhoneMask() As String
Get
If HasExtension() = True Then 'mask depends on dependency property
Return "(999) 999-9999 Ext:.9999"
Else
Return "(999) 999-9999"
End If
End Get
End Property
=======================
here is the xaml of a page that uses the telephone control
<customcontrols:Telephone Name="tlpMainTelephone"
...
HasExtension="True"
/>
=======================
When I debug, in the "PhoneMask" property of "telephone.xaml.vb" the HasExtension() statement always "False".
If HasExtension() = True Then 'HasExtension is always False !!!
Why am I getting False !!! I pass "True" in my calling page ?
<customcontrols:Telephone Name="tlpMainTelephone"
...
HasExtension="True"
Thanks in advance
-
March 22nd, 2011, 10:35 AM
#2
Re: user control - binding order problem ?
anyone care to show me the so called "power of binding" ....
-
March 23rd, 2011, 06:15 PM
#3
Re: user control - binding order problem ?
I'd like to help but I'm only good for C#. It might help if you zipped up a small sample project that repros the problem and attach it here.
That way folks could modify it and maybe solve your problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|