我在我的WPF應用程序中使用TimeSpan
。TimeSpan.FromSeconds給出指定參數的錯誤超出了有效值的範圍。參數名稱:Interval
var trigger = new TimeTrigger();
trigger.Repetition.Interval = TimeSpan.FromSeconds(3.0);
這是給我一個錯誤:
Specified argument was out of the range of valid values.Parameter name: Interval
我讀過這樣的:https://msdn.microsoft.com/en-us/library/system.timespan.fromseconds(v=vs.110).aspx
我做錯了嗎?
顯然你TimeTrigger的重複的Interval屬性拋出該異常,不FromSeconds。 – Clemens
根據[this],似乎'Interval'屬性需要一個字符串值(https://msdn.microsoft.com/en-us/library/windows/desktop/aa382119(v = vs.85).aspx ) – Pikoh
請參見[RepetitionPattern.Interval](https://msdn.microsoft.com/en-us/library/windows/desktop/aa382119(v = vs.85).aspx):「...允許的最短時間爲1分鐘。」 – Clemens