WPF UI not refresh (Revit pluggin) - wpf

I have developed a pluggin on Revit in WPF but I have a problem.
I load a family from a button in the user interface but the user interface does not update or refresh.
I force the refresh by resizing the window.
I did some research on the net but I did not find any information.
I post a youtube link to show you the manipulation.
Link: https://www.youtube.com/watch?v=9gb_YZH6i9s&feature=youtu.be

I have heard of similar issues in the past. In general I prefer using Windows Forms over WPF, since they seem to be easier to handle. Afaik, all WPF problems have been solved, though. Here is a whole list of related discussions on The Building Coder:
http://thebuildingcoder.typepad.com/blog/wpf/

You can try a "WPF DoEvents" after the loading of your family. See the answer here: https://stackoverflow.com/a/11899439/200443

Related

Windows 8 like modal dialog using WPF

I am working on a WPF-MVVM (.Net 4.0) application that has a Metro look (it just has a look, it is not a metro application.)
I need to show a windows 8 like message box that blocks the operations for the user before he rids that message box by clicking yes/no/cancel (or any button.).
I came across this otherwise great article and momentarily thought that I have found the solution. But this has its own drawback.It just stops the user from interacting with the controls behind by mouse clicks. The user can however use the tab key to get back to the buttons behind and click them (pressing enter).
A number of things are coming to my mind:
should I go for custom adorners and play with hitTestable property?
Or should I place a control and play with its visible property.
Before going for any approach I thought of putting forward my question to the wonderful community here if someone has done a similar thing in past and provide me some pointer/reference/approach.
Can someone suggest what is the way to achieve this? Please note I will be happy to use prism or any other open source if that solves the purpose but the window will have to be custom made.
Please excuse me if you find this too stupid a question. Please pardon my ignorance. Thanks for reading this.
I recently came across a similar problem, I resolved it using a DialogPresenter as explained there:
http://www.codeproject.com/Articles/36516/WPF-Modal-Dialog
I had to do a few tweaks there and there but overall it's working fine and I now have a nice way to display dialog boxes!
There is a better way of doing it
var dialog = new MessageDialog("Select Social network is already authorised!");
dialog.ShowAsync();

is there any out of the box feature in PRISM for Application level shortcuts

Hi i was just wondering if there is any out of the box /hidden feature set in PRISM which helps me achieve application level shortcuts implemented. The only closes match i got was for leveraging WPF feature set in setting up a Application level shortcutss is http://blogs.southworks.net/geoff/2011/03/15/wpfshortcutkeys/ through Application Level shortcut keys in WPF
any suggestions is welcome! Thanks!
In Prism you've got the CompositeCommand. This is basically a container that can hold child commands.
Here's a link on the MS site describing how to use them: CompositeCommands
There's also a nice piece of code that handles all of the multi-key bindings. it leverages System.Windows.Interactivity. This will give you the F1/Cntrl+Shift+P functionality essentially for free. You can find out about this here:
Gesture Behaviour
This should give you what you're looking for. And using very little code.

Can I use the WP7 Panorama control outside of WP7?

I need a WPF control that acts like the Panorama control for Windows Phone 7, but I need it for a desktop application.
It will contain a series of panels (or Panorama Items) that the application will be able to slide through horizontally programmatically.
Also, the content inside the panels not currently displayed on the screen will need to be "lazy loaded". In other words, they should be referenced but not loaded or rendered.
Can I somehow adapt the WP7 Panorama control to do this? Or will I have to develop a custom control from scratch to behave similarly to it?
Thank you!
EDIT:
I could probably use a VirtualizingPanel to implement the lazyload behaviour.
MahApps.Metro while still not super mature does allow for the wp7 Panorama control. Demo of how to use a panorama here. I've played with it a little and while its not the most customizable thing out there it gets the job done. Pretty sweet. Also Sacha Barber (Codeproject Demigod) wrote up an article on making your own. Of which I haven't looked at yet but, the guy usually does awesome work. So I'd check that one out as well.
http://blogs.microsoft.co.il/blogs/arielbh/archive/2010/10/21/porting-windows-phone-7-s-panorama-control-to-silverlight-4.aspx gives some clues about how do to this.
It suggests using http://phone.codeplex.com/ as your base and then you can use http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=4b281bde-9b01-4890-b3d4-b3b45ca2c2e4 (Microsoft Surface Manipulations and Inertia Sample for Microsoft Silverlight) to run convert get it to respond to touch.
Seems none exist as far as I can see so far.
This blog has started an attempt at making it, so you could work from there to make your own. Be sure to also check out this page which details the creation of an individual panorama item too.

Can I override the context menu in Silverlight for all browsers that support Silverlight 2.0?

It seems like a common question on Google, but I couldn't find a satisfactory answer (unless the answer is 'no')
I would like to add menu items or show a custom menu when a user right-clicks on my Silverlight app.
The closest thing that I found catches the context menu in IE, but not in Firefox, and Chrome shows the context menu and then shows the custom event.
(The tutorial I mentioned was here
http://silverlight.net/blogs/msnow/archive/2008/07/01/tip-of-the-day-14-how-to-right-click-on-a-silverlight-application.aspx)
Here you have an implementation but it's CTRL+Left click, then you get a context menu (about the text, sorry it's in spanish):
http://www.albloguera.es/?p=29
Another option, is the one pointed out do it via javascript, quite chunky solution, and not sure if now it's working in the current 2.0 version :-(.
Good Luck
Braulio
There is no way to do this natively in Silverlight.
I believe that the Telerik control noted elsewhere uses the HtmlBridge to intercept the context click, then draw their own menu, however it does not appear to be working with Silverlight 2.0.40115 now, so maybe Microsoft have closed that gap.
Having no right click is a design decision based on security concerns, rather than a technical one. However I believe that the Microsoft team are considering allowing context menu's in future versions (perhaps even v3)
I've come to the conclusion that it seems it is possible based on my use of Telerik's context menu which works fine on IE, Chrome and Firefox.
Check it out, http://demos.telerik.com/silverlight/#ContextMenu/FirstLook

Running a Silverlight Website

When using silverlight in a browser is there anyway to switch xaml pages? I'm also wondering how to go about using my encryption class I've wrote in c# to validate users in silverlight. Any help would be much appreciate!
If you're using Silverlight 3 Beta then what you're looking for is the Navigation system using the Frame and Page controls. There are lots of tutorials available online for this.
In Silverlight 2 the easiest solution is to replace the RootVisual with a Panel (like Grid or Canvas) and have your own code to switch the child elements (which are usually your own UserControls).
There's a good tutorial available at Flawless Code
We are using Jesse Liberty's method of doing the page switching in SL2. It is explained here. Jesse Liberty SL2 page switching
It also look or feels a lot like how SL3 does it with the Navigation mentioned above.
Caution: If you do this, the back button on the browser will need to be handled - users will exit out of your SL2 app when hitting the back button. SL3 has built in support for handling and responding correctly to the back button.

Resources