dear all,
I run into problem with progressbar . some time gave progressbar value 0, but it show full progress status. following is code :
My xaml:
the display result please see attachement. give the same value some(value= 0 ) progrssbar is ok,others is full progrss status. why?
please help me ,thanks !
I run into problem with progressbar . some time gave progressbar value 0, but it show full progress status. following is code :
var wolist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<workorder>>(e2.Result);
List<SaWOProcess> list =
new
List<SaWOProcess>();
lbSaProcess.ItemsSource =
null
;
foreach
(var item
in
wolist)
{
double
v = 0.0;
double
qty = item.Qty ?? 0.0;
if
(item.CompletedQty !=
null
)
{
v = (
double
)item.CompletedQty / (
double
)item.Qty * 100.0;
}
list.Add(
new
SaWOProcess() { Qty = qty, WOId = item.Id, WOName = item.WOName, CurrentValue = Convert.ToInt32(v) , TotalInfo =
string
.Format(
"{0}/{1}"
, item.CompletedQty, qty) });
}
lbSaProcess.ItemsSource = list;
lbSaProcess.UpdateLayout();
My xaml:
<
UserControl.Resources
>
<
DataTemplate
x:Key
=
"dataTemplate"
>
<
Canvas
VerticalAlignment
=
"Center"
Margin
=
"10"
Height
=
"50"
>
<
TextBlock
Foreground
=
"#FF393838"
x:Name
=
"loadingPercentage"
VerticalAlignment
=
"Center"
Canvas.Top
=
"16"
Text
=
"{Binding WOName}"
FontSize
=
"15"
/>
<
telerik:RadProgressBar
x:Name
=
"pb"
Canvas.Top
=
"16"
VerticalAlignment
=
"Center"
Canvas.Left
=
"100"
Width
=
"500"
Height
=
"22"
Minimum
=
"0"
Value
=
"{Binding CurrentValue}"
Maximum
=
"100"
/>
<
TextBlock
Canvas.Left
=
"630"
Canvas.Top
=
"16"
VerticalAlignment
=
"Center"
Foreground
=
"#FF393838"
x:Name
=
"tbTotal"
Text
=
"{Binding TotalInfo}"
FontSize
=
"15"
/>
<
Button
x:Name
=
"btnViewDetail"
Canvas.Top
=
"16"
VerticalAlignment
=
"Center"
Tag
=
"{Binding WOId}"
Canvas.Left
=
"685"
HorizontalAlignment
=
"Right"
Foreground
=
"Black"
Content
=
"ViewDetail"
Click
=
"btnViewDetail_Click_1"
/>
</
Canvas
>
</
DataTemplate
>
</
UserControl.Resources
>
<
ListBox
Name
=
"lbSaProcess"
Grid.Row
=
"1"
ItemTemplate
=
"{StaticResource dataTemplate}"
BorderThickness
=
"0"
Width
=
"790"
Height
=
"750"
>
</
ListBox
>
public
class
SaWOProcess
{
public
int
WOId {
get
;
set
; }
public
string
WOName {
get
;
set
; }
public
int
CurrentValue {
get
;
set
; }
public
string
TotalInfo {
get
;
set
; }
public
double
Qty {
get
;
set
; }
}
the display result please see attachement. give the same value some(value= 0 ) progrssbar is ok,others is full progrss status. why?
please help me ,thanks !