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!
<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}}"/>
You can try DataContext="{Binding ElementName=LaunchableApplicationControl}"
and bind to a property which will set ZIndex
. Make sure you implement INotifyPropertyChanged
interface
.
private int _Zindex;
public int Zindex
{
get { return _Zindex; }
set
{
if (_Zindex == value)
{
return;
}
_Zindex = value;
NotifyPropertyChanged("Zindex");
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.