Sabit arka plan görüntüsüne sahip bir düğme var ve bunun üzerine küçük bir yer paylaşımlı görüntü göstermek istiyorum. Hangi bindirme görüntüsünün seçileceği, ilgili viewmodel'in bir bağımlılık özelliğine (LapCounterPingStatus
) bağlıdır.datatrigger resim
Bu defa ne var: Şu anda benim ViewModel
public class ConfigurationViewModel
{
public enum PingStatus { PING_UNKNOWN, PING_SUCCESS, PING_FAILURE };
public PingStatus LapCounterPingStatus
{
get { return _lapCounterPingStatus; }
set
{
_lapCounterPingStatus = value;
RaisePropertyChanged(LapCounterPingStatusPropertyName);
}
}
}
ait
<Button>
<Grid>
<Image Stretch="None"> <!-- Background Image -->
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="Source" Value="/Images/Pingn.png"/>
</Style>
</Image.Style>
</Image>
<Image Stretch="None" Panel.ZIndex="1"> <!-- Small Overlay Image -->
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=LapCounterPingStatus}" Value="PingStatus.PING_UNKNOWN">
<Setter Property="Source" Value="/Images/RefreshOverlayn.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=LapCounterPingStatus}" Value="PingStatus.PING_FAILURE">
<Setter Property="Source" Value="/Images/ErrorOverlayn.png"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=LapCounterPingStatus}" Value="PingStatus.PING_SUCCESS">
<Setter Property="Source" Value="/Images/CheckmarkOverlayn.png"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</Grid>
</Button>
ilgili kısımlar, hiçbir bindirme görüntüsü görüntülenir. Ne yanlış olabilir? Benim IDE
GÜNCELLEME
İz pencere System.ArgumentException
ve System.FormatException
gösteriyor. Sorun kaynağı bilinmeyen bir numaralandırma numarası olabilir PingStatus
XAML?
İlgili: http : //stackoverflow.com/q/10250925/590790 Bu adam alnı çalışmasına rağmen ady. –