Sabit bir arka plan resmine sahip bir düğmem var ve bunun üzerinde küçük bir bindirme resmi göstermek istiyorum. Hangi bindirme görüntüsünün LapCounterPingStatusseçileceği, ilgili görünüm modelinin bağımlılık özelliğine ( ) bağlıdır .
Şu ana kadar elde ettiğim şey bu:
<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>
Görünüm modelimin alakalı bölümleri
public class ConfigurationViewModel
{
public enum PingStatus { PING_UNKNOWN, PING_SUCCESS, PING_FAILURE };
public PingStatus LapCounterPingStatus
{
get { return _lapCounterPingStatus; }
set
{
_lapCounterPingStatus = value;
RaisePropertyChanged(LapCounterPingStatusPropertyName);
}
}
}
Şu anda hiçbir bindirme görüntüsü görüntülenmiyor. Ne yanlış olabilir?
GÜNCELLEME
Benim IDE İz penceresi gösteriyor System.ArgumentExceptionve System.FormatException. Sorun kaynağı PingStatus, XAML'de bilinmeyen bir numaralandırma türü olabilir mi?