이것은 모든 질문 중에서 가장 단순한 것이어야하지만 알아낼 수는 없습니다. 진행률 막대가 제자리에 있으며 진행 상황을 어떻게 보이게합니까? 어떻게 시작해야합니까?WPF 진행률 막대에서 Indeterminate = "True"일 때 어떻게 진행합니까?
<ProgressBar x:Name="ProgressUpload" Margin="5" IsIndeterminate="True" ></ProgressBar>
이것은 모든 질문 중에서 가장 단순한 것이어야하지만 알아낼 수는 없습니다. 진행률 막대가 제자리에 있으며 진행 상황을 어떻게 보이게합니까? 어떻게 시작해야합니까?WPF 진행률 막대에서 Indeterminate = "True"일 때 어떻게 진행합니까?
<ProgressBar x:Name="ProgressUpload" Margin="5" IsIndeterminate="True" ></ProgressBar>
IsIndeterminate를 True로 설정하면 진행 상황이 진행 중임을 나타내지 만 정확한 기간을 확인할 수 없습니다. 그래서 나는 단지 false로 설정하고 "표준"동작에서 진행률 표시 줄을 사용하도록 말할 수 있습니다.
진행 표시 줄을 시작하지만 불확정 막대로 만들려는 경우 준비가되면 IsIndeterminate 속성을 true로 설정하고 완료되면 false로 설정해야합니다. 그래서 다른 말로
:
pbar.IsIndeterminate = true; //This starts your bar's animation
pbar.IsIndeterminate = false; //This stops your bar's animation
는 당신에게 당신이 그것을 다음과 같은 사이비 코드에서이 방법으로 모양을하고 싶은 것이 이유에 컨텍스트를 제공하려면 :
//Some method that is going to start something that is going to take a while
public void StartLongRunningProcess()
{
//Make a call to a web service asynchronously etc...
//Start the animation for your progress bar
pbar.IsIndeterminate = true;
}
//The method (delegate) that handles the result, usually from an event.
//This method will handle the result of the asynchronous call
public void HandlerForLongRunningProcess()
{
//Do stuff with result from your asynchronous web service call etc...
//Stop the animation for your progress bar
pbar.IsIndeterminate = false;
}
내가 먼저하자 말하자면 이것이이 속성의 의도 된 사용법인지 확실치 않지만 분명히 작동한다고 말할 수 있습니다.
MVVM을 사용하여 진행률 표시 줄에 비동기 호출을 추가하는 방법에 대해 혼란스러워합니다. http://stackoverflow.com/questions/25021838/indeterminate-progress-bar –
분명히 일부 환경에서는 불확실한 애니메이션을 실행하려면 높이를 명시 적으로 설정해야하지만 다른 경우에는 필요하지 않습니다.
초기화하는 동안 (즉, XAML의 UI 디자이너 또는 코드 측의 생성자) 소유권을 갖는 창의 IsIndeterminate로 설정하지 마십시오. 그렇게하면 애니메이션이 시작되지 않습니다. 'Loaded'이벤트 핸들러 내에서 설정하십시오.
내가 XAML 측 IsIndeterminate = 'False'
있을 것입니다, 다음이 Window_Loaded
이벤트 설정에서 :
myProgressBar.IsIndeterminate = true;
문제의 가능한 해결 방법이 간단하게 표시하거나 ProgressBar 컨트롤 숨기기 :
progressBar.Visibility = Visibility.Visible;
progressBar.Visibility = Visibility.Collapsed;
을
위의 @dyslexicanaboko와 다른 점은 없지만 제어 할 수있는 데모를 위해 빠르고 쉽게 할 수 있습니다.
XAML에서 :
Public Sub StartAProcess()
pBar1.IsIndeterminate = True
End Sub
Public Sub StopAProcess()
pBar1.IsIndeterminate = False
End Sub
애니메이션이 시작하고 중지 프로세스 버튼을 클릭 할 때까지 계속 시작 프로세스 버튼을 클릭하면 : 뒤에 코드에서
<Button Content="Start Process" HorizontalAlignment="Center" Click="StartAProcess"/>
<Button Content="Stop Process" HorizontalAlignment="Center" Click="StopAProcess"/>
<ProgressBar Name="pBar1" Height="20"/>
. 그것은 분명해야하지만 IsIndeterminate 옵션은 좋은 UI 관행이 아닙니다. 실제로 값을 업데이트하는 것이 더 좋지만 실제로이를 보려는 사람들에게는 ...
CacheMode = "BitmapCache"가 페이지에 설정되어 있지 않은지 확인하십시오. 그렇지 않으면 애니메이션이 실행되지 않습니다. 그냥 캐시 된 비트 맵을 표시합니다 ...
왜 처음에는 IsIndeterminate = "True"가 있습니까? –