读书人

wpf 进度条,该怎么解决

发布时间: 2012-06-06 16:44:11 作者: rapoo

wpf 进度条

C# code
                Action<DependencyProperty, double> UpdateProgressbarValue = (dp, value) => pb.SetValue(dp, value);                  double myvalue = 0;                pb.Minimum = 0;                pb.Maximum = output.RoundPlanSequences.Count;                pb.Value = 0;                foreach (RoundPlanSequence seq in output.RoundPlanSequences)                {                    myvalue += 1;                    pb.Dispatcher.Invoke(UpdateProgressbarValue,                    System.Windows.Threading.DispatcherPriority.Background,                    System.Windows.Controls.ProgressBar.ValueProperty, myvalue);                    tempDic.Add(int.Parse(seq.Attributes["ViewRow"].ToString()), seq);                    //----------------------从新修改部分                    RoundPlanContentTO to = new RoundPlanContentTO();                    to.Row = int.Parse(seq.Attributes["ViewRow"].ToString());                    to.Column = 11;                    to.Name = seq.Name;                    //to.LabelContent = seq.Barcode;                    bb.Data = seq.Barcode;                    bb.encode();                    to.LabelContent = CreateBarCodeByString(bb.EncodedData, bb.Data);                                        //RoundPlanSequence.Children.Add(lb);                    _roundPlan.Contents.Add(to.Name, to);                                        //-----------------------从新修改部分                }   



为何运行以来,看不到 进度条的变化,

[解决办法]
确认初始化成功了么?
可以debug看看控件是否初始化成功。

另外可以参考:http://www.silverlightchina.net/html/study/WPF/2012/0410/15180.html

读书人网 >CAD教程

热点推荐