If I bind a control's ZIndex to a property, although the property is clearly called when I debug (the breakpoint is hit on the getter), the zindex doesn't seem to work (ie. the zindex doesn't change in the running application properly; the elements on the control are no longer clickable if I set the zindex to be bound to a property rather than a set value in XAML). Any idea why, or how to fix this? Thanks for the help!
如果将控件的ZIndex绑定到一个属性,尽管当我调试时,属性被清楚地调用(断点在getter中被击中),则ZIndex似乎不起作用。zindex在运行的应用程序中没有正确地更改;如果我将zindex设置为绑定到属性而不是XAML中的设置值,则控件上的元素不再可单击。知道为什么吗,或者怎么解决这个问题?谢谢你的帮助!
<views:LaunchableApplicationControl BorderThickness="0"
BorderBrush="DarkSlateGray" x:Name="LaunchableApplicationControl"
Grid.Column="1" Margin="25,150,25,50"
Panel.ZIndex="{Binding LaunchableControlZIndex}"
Grid.Row="0" Grid.RowSpan="2"
DataContext="{Binding LaunchableApplication, Mode=OneWay,
Source={StaticResource Locator}}"/>
1 个解决方案
#1
0
You can try DataContext="{Binding ElementName=LaunchableApplicationControl}"
and bind to a property which will set ZIndex
. Make sure you implement INotifyPropertyChanged
interface
.
您可以尝试DataContext=“{Binding ElementName=LaunchableApplicationControl}”并绑定到将设置ZIndex的属性。确保实现了INotifyPropertyChanged接口。
private int _Zindex;
public int Zindex
{
get { return _Zindex; }
set
{
if (_Zindex == value)
{
return;
}
_Zindex = value;
NotifyPropertyChanged("Zindex");
}
}
#1
0
You can try DataContext="{Binding ElementName=LaunchableApplicationControl}"
and bind to a property which will set ZIndex
. Make sure you implement INotifyPropertyChanged
interface
.
您可以尝试DataContext=“{Binding ElementName=LaunchableApplicationControl}”并绑定到将设置ZIndex的属性。确保实现了INotifyPropertyChanged接口。
private int _Zindex;
public int Zindex
{
get { return _Zindex; }
set
{
if (_Zindex == value)
{
return;
}
_Zindex = value;
NotifyPropertyChanged("Zindex");
}
}