This is a migrated thread and some comments may be shown as answers.

RadBusyIndicator Not Showing in MVVM App

14 Answers 1411 Views
BusyIndicator
This is a migrated thread and some comments may be shown as answers.
Paul Patterson
Top achievements
Rank 1
Paul Patterson asked on 28 Jan 2011, 07:14 PM
Trying to display a RadBusyIndicator in an WPF MVVM application however the control does not appear when IsBusy binding occurs.

Here is a portion of what is in the user control xaml...

<Grid>
  <telerik:RadBusyIndicator IsBusy="{Binding IsBusy}" Grid.Row="0" >
    <Grid>
      <StackPanel Margin="10,10,10,10">
          ...some content here...                 
      </StackPanel>
    </Grid>
  </telerik:RadBusyIndicator>
</Grid>

I bind the IsBusy to a property in my ViewModel, set the property to true, and then fire OnPropertyChanged to rebind the view. Unfortunately the BusyIndicator does not show.

Has anyone experienced this challenge before, and if so, what was done to resolve it?

I'll follow up this post with an example solution that recreates the problem. Until then, let me know if you have any insights into this.

Cheers, 

Paul

14 Answers, 1 is accepted

Sort by
0
Paul Patterson
Top achievements
Rank 1
answered on 29 Jan 2011, 12:03 AM
Solved it!

Built an async specific delegate command for my ViewModel and then hooked into that to update the IsBusy binding. Even threw in some view navigation with a RadTransitionControl cherry on top! All is good :)

If you are curious how this was all put together, let me know and I'll post about it on my blog. (Ah, I'll post about it anyway otherwise I'll forget what I did :P )

Cheers!
0
Andreas Lindahl
Top achievements
Rank 1
answered on 02 Feb 2011, 01:48 PM
Hi Paul,

I am very interested in your solution so please do post it on your blog if possible.

Thanks in advance!
0
Paul Patterson
Top achievements
Rank 1
answered on 02 Feb 2011, 03:47 PM
Hi Andreas,

I am working on it right now (www.PaulSPatterson.com). 

Cheers!
0
Ronak
Top achievements
Rank 1
answered on 03 Feb 2011, 05:01 PM
Hi Paul
I am working on MVVM pattern with Command in Silverlight can you please share with me how did u utilize busyIndicator in MVVM.
i will appriciate your work.
0
Paul Patterson
Top achievements
Rank 1
answered on 03 Feb 2011, 10:07 PM
I'll be posting a full example on my blog (soon). Until then, check out this article by Anoot Madhusudanan here. http://amazedsaint.blogspot.com/2010/10/asynchronous-delegate-command-for-your.html . 

What I did was, when the async command is executed, the delegate action updates a boolean property (which happens to be named isBusy) in the ViewModel to true. When the async command is done, the isBusy property is set back to false.

For example, in my ViewModel...

Namespace ViewModels
  Public Class UserLoginViewModel
    Inherits ViewModelBase
 
    Private _isBusy As Boolean = False
 
    Public Property IsBusy As Boolean
        Get
            Return _isBusy
        End Get
        Set(ByVal value As Boolean)
            _isBusy = value
           OnPropertyChanged("IsBusy")
        End Set
    End Property
 
    Public Property LoginAsyncCommand As ICommand
        
    Public Sub New(ByVal regionManager As IRegionManager, ByVal container As IUnityContainer)
 
       Dim loginAction As Action = New Action(AddressOf LoginExecute)
       LoginAsyncCommand = New AsyncDelegateCommand(loginAction, Nothing, Sub() LoadView())
 
     End Sub
 
  Private Sub LoginExecute()
       If IsBusy Then
         Exit Sub
       End If
        IsBusy = True
        ' Do some login stuff here...
             IsBusy = False
 End Sub
 
   Public Sub LoadView()
        Try
                If _loginSuccess Then
                '   Do some view management here.
                End If
            Catch ex As Exception
                LoginSuccess = ex.Message
            End Try
        End Sub
 
   End Class
End Namespace

AsyncDelegateCommand is a class that is the same that Anoot wrote about.

In the View...
<Grid>
  <telerik:RadBusyIndicator IsBusy="{Binding IsBusy}" Grid.Row="0">
    <Grid>
      <StackPanel>
        <!-- Some content here.... -->
        <Button x:Name="LoginCommand" Content="Login..."  Command="{Binding LoginAsyncCommand}"/>
      </StackPanel>
    </Grid>
  </telerik:RadBusyIndicator>
</Grid>

I have a lot more happening in there of course - with Prism and all, but this should get you started.

- Cheers

 


0
Ronak
Top achievements
Rank 1
answered on 03 Feb 2011, 10:10 PM
Thanks Paul for your Quick reply.
0
Paul Patterson
Top achievements
Rank 1
answered on 12 Feb 2011, 12:08 AM
Hello,

As promisied, here is the link to the blog posting on how I implemented an asynchronous command delegate to achieve the RadBusyIndicator in an MVVM application. 

   www.PaulSPatterson.com

Cheers!
0
Teodor
Telerik team
answered on 16 Feb 2011, 03:30 PM
Hello Paul,

Please refer also to this online demo to see RadBusyIndicator in a MVVM scenario with proper behavior when changing the IsBusy property. 

Hope this will be of use. We will be glad to assist you further.

Regards,
Teodor
the Telerik team
0
Paul Patterson
Top achievements
Rank 1
answered on 16 Feb 2011, 04:21 PM
I was able to resolve this already (as per the link I provided earlier). Thanks anyway.
0
Andreas Lindahl
Top achievements
Rank 1
answered on 16 Feb 2011, 05:02 PM
0
Vlad
Telerik team
answered on 16 Feb 2011, 05:04 PM
Hi,

 I've just tried the demo an it works as expected. You can check the attached screenshot. 

Regards,
Vlad
the Telerik team
0
Mark
Top achievements
Rank 1
answered on 29 Aug 2011, 03:50 PM
I would be interested. I glanced at your website and didn't see it.

-Markus
0
Konstantina
Telerik team
answered on 01 Sep 2011, 02:24 PM
Hello Markus,

You can also get the link for the demos from the WPF products' page: http://www.telerik.com/products/wpf.aspx

Kind regards,
Konstantina
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Rob
Top achievements
Rank 1
answered on 26 Jul 2016, 02:44 AM

fyi - this is a few years later, following the link to Paul's site triggers my Alvira anti-virus

"The site ahead contains malware"

 

Tags
BusyIndicator
Asked by
Paul Patterson
Top achievements
Rank 1
Answers by
Paul Patterson
Top achievements
Rank 1
Andreas Lindahl
Top achievements
Rank 1
Ronak
Top achievements
Rank 1
Teodor
Telerik team
Vlad
Telerik team
Mark
Top achievements
Rank 1
Konstantina
Telerik team
Rob
Top achievements
Rank 1
Share this question
or