Just wondering if anybody has any advice on making a custom loading indicator/HUD for silverlight that resembles the MBProgressHUD for the iphone.
https://github.com/jdg/MBProgressHUD
All I want is a busy indicator, like the one that comes with the silverlight toolkit but to style it like the MBProgressHUD with a spinning loading indicator.
Any ideas?
Thanks
Just create a custom control with appropriate animations and elements arranged in a circle (see rotate transforms).
You may wish to use a timer in the code behind but if you do, be sure to un-hook the event handler when the progress indicator is no longer displayed or you will leak memory.
If you then want to use it as the one in the silverlight toolkit just use your control in a controltemplate for the busy indicator in the silverlight toolkit. Alternatively just create your own version of the control (Alignment set to center, visibility to show/hide, a background which fills the screen if you need it to disable clicking on the form behind, but it as the last item in your layout-root so it's on top).
Related
On click of a button I need to freeze (Read Only) the entire screen even the menus / tab controls is there any possibility to do that.
Have you tried setting Application.Current.MainWindow.IsEnabled=false? That should propagate down to all other controls which have not overriden IsEnabled.
If you're looking for MVVM way: Disable WPF buttons during longer running process, the MVVM way
In Silverlight for Windows phone, I need to go to a specific place in a page by code (hopefully with animation). The requirement is a bit like navigate to a specific anchor in HTML using url such as http://url#anchorname. However, I don't know how to do it in Windows Phone. Any ideas?
What do you mean by "go"? You could try setting the focus on a control calling control.Focus(). If you want to just scroll a ScrollViewer or a ListBox to display a control that is inside of it - WPF had a BringIntoView() method that some people ported to Silverlight, eg. here.
If you want animation - you will need to add an attached dependency property that will allow to run an animation updating the scroll offset using ScrollToVerticalOffset(). Then have the BringIntoView implementation - instead of just jumping to the offset using ScrollToVerticalOffset - run an animation that will update the attached dependency property and smoothly animate calling ScrollToVerticalOffset many times.
I would like to have a form which has a few controls as transparent overlays over a bitmap. This bitmap is subject to transform matrix (zoom & scroll). I'm trying to achieve a look similar to GoogleMaps where the controls do not move when the background image is panned/zoomed.
I've tried to mimic this in my OnPaint. However, when the window is scrolled only the newly exposed area gets invalidated so my control doesn’t repaint.
I've tried to calculate where the old control was, invalidate that area, and also invalidate the area where it's supposed to have been. When I do this it flickers and you can still see the image as its scrolled.
I tried to put a ButtonControl on my display window. However, it always scrolls with its parent control. I tried to capture the scroll events and then adjust the position of the ButtonControl. This also has a delay update effect so it looks not so good.
Any ideas would be greatly appreciated.
It sounds to me like you need to Invalidate() your control wich handles the OnPaint event.
Unfortunately, you get the flicker because the Auto-scrolling mechanism sets its position, and then you restore it. The result is two messages being sent to the button.
Place your bitmap and scroll logic in a separate control that fill the entire form. That means both your bitmap control and the button are child controls of the form.
Alternatively, draw the button yourself. You will then of course need to do some work on getting it to respond to mouse clicks etc. The ControlPaint class has methods that help you mimic the appearance of Windows controls.
I have WPF ListBox that shows a lot of data. I need smooth scrolling, so I've set ListBox.ScrollViewer.CanContentScroll to False that disables virtualization. Now when I open the tab where this ListBox is placed, I see nothing for few seconds because ListBox is loading/creating items/rendering. I also have a control that shows some animation that indicates that application is running and user should wait a bit.
How can I show this control while ListBox is not available?
Add a Grid in the location of your list box and place inside it your ListBox and your animation control. This way they are placed in the same location. The animation control should be on the top of the z-order and so displayed. Once the ListBox has finished loading you would then hide the animation control and so the ListBox would show instead. Any time you need to perform another long operation you set the animation control to visible again.
Clean shutdown in Silverlight and WPF applications
Check how the author of this application did it via code maybe it can help you though it is different scenario.
How can i add a control to a Silverlight Grid control without blocking the user interface.
I am creating a complicated Chart control and when i call myGrid.Children.Add(myChart) the whole page is blocked and not responding.
Any idea guys?
A few things you could try:
Wrap your call to add the chart inside of Dispatcher.BeginInvoke([add chart]). This will cause the chart to not be added until the current round of UI work is done and may help it be more responsive.
Add the chart without any data to the UI. Then in the background load the data and use bindings to have the data rendered in the chart.
Try to figure out how you can break apart your complicated chart. So maybe you can add the chart first, then add some of the other items as you go.
Make sure your data for the chart is already loaded before you add the chart. I'm assuming you're already doing this, but just want to double check.
Those are my only ideas.
Have you tested whether this is a XAML rendering issue or instantiating the chart control that is causing the blocking?
What happens when you set the Visibility of the chart to Collapsed and add that to the grid? Obviously you won't see it on the UI, so you'll either need to step through it via debug or simply pop up a MessageBox before and after you call the Add(myChart).
If it is the XAML rendering of the chart, I'd dive deeper into the XAML that chart control and look for optimizations (if you can, what chart control is this?).