简体   繁体   English

Visual Studio 2012 WPF中没有ProgressBar.Value属性

[英]ProgressBar.Value property not available in Visual Studio 2012 WPF

I'm trying to learn C#. 我正在尝试学习C#。 I'm using Visual Studio 2012 Express and WPF in this case. 在这种情况下,我使用的是Visual Studio 2012 Express和WPF。

I'm trying to get the ProgressBar.Value property to become available to be used but it won't come up even though I've got the System.Windows.Controls class enabled and defined. 我正在尝试使ProgressBar.Value属性变得可以使用,但是即使启用并定义了System.Windows.Controls类,它也不会出现。

I can select the ProgressBar.ValueProperty property though. 我可以选择ProgressBar.ValueProperty属性。 I googled it and didn't come up with any reasons why it's missing so far… 我在Google上搜索了该图片,但并没有提出任何原因导致它至今丢失。

I think you made a confusion. 我觉得你很困惑。 You can assign a Value only to instances of ProgressBars, not to the class itself. 您只能将Value分配给ProgressBar的实例,而不能分配给类本身。

ProgressBar myProgressBar = new ProgressBar();
myProgressBar.Value = 30;

It would be a better idea to start learning first OOP (Object oriented programming) instead of C#. 最好是先学习OOP(面向对象程序设计)而不是C#。

Do it on the design view, select the ProgressBar go the proprieties panel (right) and look for Value you can change it as you want, 在设计视图上执行此操作,选择“ ProgressBar”,进入“属性”面板(右侧),然后查找“ Value”,您可以根据需要更改它,

Therefore if you want to edit it programmatically : Create your instance ( drag and drop from the toolbox or create it using XAML or C# ) and then access it via code : 因此,如果要以编程方式进行编辑:创建实例(从工具箱拖放或使用XAML或C#创建实例),然后通过代码访问它:

myProgressBar.Value = 100;

XAML creation code : XAML创建代码:

 <ProgressBar x:Name="myProgressBar" Value="100" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM