固定。必須綁定最大值和價值,它的工作。在測試中,我綁定了兩個Int32(沒有測試綁定兩個)。微軟我認爲這是一個錯誤。進度條綁定值
<ProgressBar Grid.Row="8" Grid.Column="0" HorizontalContentAlignment="Stretch" Height="20" Maximum="{Binding Path=DF.WFBatchFolderStatus.DocCount}" Value="{Binding Path=DF.WFBatchFolderStatus.DocCountComplete}" PresentationTraceSources.TraceLevel="High" />
什麼是協議。如果我回答我自己的問題,我應該刪除該問題嗎?
當我嘗試爲進度條綁定值時出現錯誤。 XamlParseException'設置屬性'System.Windows.Controls.Primitives.RangeBase.Value'拋出一個異常。' Grid.Row 8失敗,Grid.Row 9失敗。當我輸入固定值(Grid.Row 6和Grid.Row 7)時,它可以工作。我可以在TextBlock(Grid.Row 5)中檢索想要綁定的值。我嘗試綁定到Double和Int 32.根據文檔Minimum,Maximum和Value是雙倍的。它失敗的計算值是2(並且在其他值上失敗)。在此先感謝,我將標記答案。
<TextBlock Grid.Row="5" Grid.Column="0" HorizontalAlignment="Left" Text="{Binding Path=DF.WFBatchFolderStatus.DocPctComplete, StringFormat='Document Pct Count: {0}'}" PresentationTraceSources.TraceLevel="High" />
<ProgressBar Grid.Row="6" Grid.Column="0" HorizontalContentAlignment="Stretch" Height="20" Minimum="0" Maximum="100" Value="40" />
<ProgressBar Grid.Row="7" Grid.Column="0" HorizontalContentAlignment="Stretch" Height="20" Minimum="0E0" Maximum="100E0" Value="60E0" />
<ProgressBar Grid.Row="8" Grid.Column="0" HorizontalContentAlignment="Stretch" Height="20" Minimum="0" Maximum="100" Value="{Binding Path=DF.WFBatchFolderStatus.DocPctCompleteInt}" PresentationTraceSources.TraceLevel="High" />
<ProgressBar Grid.Row="9" Grid.Column="0" HorizontalContentAlignment="Stretch" Height="20" Minimum="0E0" Maximum="100E0" Value="{Binding Path=DF.WFBatchFolderStatus.DocPctComplete}" PresentationTraceSources.TraceLevel="High" />
public Double DocPctComplete
{
get
{
if (BatchFolderStatus == enumBatchFolderStatus.Waiting) return 0;
if (BatchFolderStatus == enumBatchFolderStatus.WaitQC) return 0;
if (BatchFolderStatus == enumBatchFolderStatus.Complete) return 100;
if (DocCount < 1) return 0;
if (DocCountComplete < 1) return 0;
double docPctComplete = (Convert.ToDouble(DocCountComplete)/Convert.ToDouble(DocCount)) * 100E0;
Debug.WriteLine("docPctComplete " + docPctComplete.ToString());
return docPctComplete;
}
}
public Int32 DocPctCompleteInt
{
get
{
if (BatchFolderStatus == enumBatchFolderStatus.Waiting) return 0;
if (BatchFolderStatus == enumBatchFolderStatus.WaitQC) return 0;
if (BatchFolderStatus == enumBatchFolderStatus.Complete) return 100;
if (DocCount < 1) return 0;
if (DocCountComplete < 1) return 0;
double docPctComplete = (Convert.ToDouble(DocCountComplete)/Convert.ToDouble(DocCount)) * 100E0;
Debug.WriteLine("docPctComplete " + docPctComplete.ToString());
Int32 docPctCompleteInt = Convert.ToInt32(docPctComplete);
Debug.WriteLine("docPctCompleteInt " + docPctCompleteInt.ToString());
return docPctCompleteInt;
}
}
協議是回答你自己的問題,並將其標記爲接受,這樣,如果有人正在尋找類似問題的答案,他將被重定向到這個問題。 –