I am trying to bind a contextual group to the IsActive property using a custom property of a UserControl. The contextual tab should only be shown after the user has selected a port from a dropdown list. I have tried each of the following with no success, but hopefully it gives you an idea of what I'm trying to do.
Where IsPortSelected is the property in MyRibbon:
Is there something wrong with my binding statement? Or do I need to do something else in the code behind, such as implementing a PropertyChangedEventHandler (which I have tried with no success as well)?
<telerik:RadRibbonView.ContextualGroups>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM"
IsActive=
"{Binding RelativeSource={RelativeSource Self}, Path=IsPortSelected}"
/>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM"
IsActive=
"{Binding ElementName=_this, Path=IsPortSelected}"
/>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM"
IsActive=
"{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:MyRibbon}}, Path=IsPortSelected}"
/>
<telerik:RadRibbonContextualGroup x:Name=
"xCOM"
IsActive=
"{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=IsPortSelected}"
/>
</telerik:RadRibbonView.ContextualGroups>
Where IsPortSelected is the property in MyRibbon:
string
_port =
""
;
public
string
Port
{
get
{
return
_port; }
set
{
if
(_port == value)
{
return
;
}
_port = value;
}
}
public
bool
IsPortSelected
{
get
{
if
(String.IsNullOrEmpty(_port))
{
return
false
;
}
else
if
(_port.Equals(
"Port"
)) {
return
false
;
}
return
true
;
}
set
{ }
}
Is there something wrong with my binding statement? Or do I need to do something else in the code behind, such as implementing a PropertyChangedEventHandler (which I have tried with no success as well)?