mahapps.metro with ExcelDNA not working - mahapps.metro

Posting here to see if any mahapps.metro experts might have an idea. Let me know if 'cross posting' is bad form. (Or if you want me to replicate my post here)
https://groups.google.com/forum/#!topic/exceldna/POi8EYfXsOE
Update: I created a repo as asked at https://github.com/terryaney/ExcelDNAMahappsDebug
The strange thing was, when I recreated problem here the window appeared correct, so I don't know what I did different. I then tried to create the window again in my real project and was able to create the window AGAIN correctly.
I guess my question now is (and maybe you don't have to look at repository, not sure) is: How come the window in design time doesn't look like a mahapps.metro window? (note, this is my first xaml/wpf effort).

As my update states, it seems to work after I re-implemented it. This project/repo is too convoluted for the other part of my question, so I'm just closing this.
Moderator, feel free to delete.

Related

WPF Designer: "No document Root"

I'm creating a WPF Application which worked really good until now. I create it with Visual Studio 2019 Professional.
But since a few changes in a Usercontrol I have a curios issue. When I change something in the XAML it changes in the Designer.
But when I start it now, the Design View disappear an I only see this: No document root.
I have no idea whats the problem. Anyone knows a solution?
I found a solution. But not the reason of my problem. We use git, so I deleted my solution and cloned it again. And then it worked.
But I have no idea what went wrong before, it was exactly the same code.

WPF Ribbon not displaying correctly in Designer [duplicate]

I'm using thbe Microsoft Ribbon for WPF (System.Windows.Controls.Ribbon) and VS2015. Since I removed unnecessary depencies from my project (like Dynamic Data Display etc, things not related to the ribbon) it does not render correctly in the Designer anymore. All RibbonButtons get rendered as usual buttons and so on.
I used the Clean Solution option and also rebuild multiple times, without sucess. While execution everything is fine, just the designer can't handle the ribbon anymore. What could have caused this strange behaviour?
This is how my ribbon looks now in the designer:
And this is how it's supposed to look and looked before:
Update: it clearly seems to be a visual studio bug, as I opened the project on another machine with the same VS version and there everything is fine.
deleting %LOCALAPPDATA%\Microsoft\VisualStudio\14.0\Designer\ShadowCache wasn't working but this:
close solution (at best every instance of VS, you never know)
delete bin\ and obj\ in solution folder ("Clean Solution" isn't enough nowadays. Why should it? It isn't anything anyone would ever do if VS is doing strange things. Maybe I should fall back to kill -9 devenv.exe && git clean -fX as default m( )
Reopen solution and hope for the best.
This drove me nuts. The only real google hits for this problem was this SO question, another one without any answer, 500+ pseudomirrors of SO and thousands of false positives... sorry for the rant.
The problem was resolved by clearing the Visual Studio Designer Cache.
This is done by deleting the subfolders in %LOCALAPPDATA%\Microsoft\VisualStudio\14.0\Designer\ShadowCache

Printing reports from WPF

I've been searching the web for over 2 days now for a good and easy to use something to print reports from a WPF application.
I've been trying to use the DocumentViewer but it's a pain to add Controls to it and style them. Is it me or can this only be done in code behind and how can a grid over multiple pages dynamically be generated?
Second I found the control FlowDocumentReader. This looks like an interesting thing since you can add Tables which are much easier to style and I was able to do this in xaml. Unfortunately, I have no clue how to print from it. I tried to edit the template of the reader but without success.
Last I found this post (What's the best approach to printing/reporting from WPF?) but it's dated to 2008 so I'm not sure if the information is still accurate.
My conclusion is that it is pretty hard to get a nice looking report printed from WPF without writing lots of code behind or editing templates which (by me) fail to do what I want.
So my question is, is there any good approach to my problem? I'm really bothered that I lost this much time for something that I thought was so trivial to do.
I was wonder, what about this guy's approach: https://stackoverflow.com/questions/17647939/how-do-we-handle-different-printing-needs-by-using-fixeddocument?rq=1?
Crystal Reports is indeed a good choice for complicated reports but if your reports will be simple in design I'll recommend using CodeReason reports, it's an xaml based reports. Too bad it's not updated anymore but it's really easy to use for simple reports.
For more information: http://wpfreports.codeplex.com/

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();

Theming using resources without Blend vomitting

WPF is great in that I should be able to use {StaticResource MyBackground} instead of "White" throughout my app, and then by changing resource definitions redefine the look of my entire application.
Problem is Expression Blend just won't work if you have references to global resources in a subcontrol. Is there any other way of theme-ing your app? I am not willing to lose Blend designer support, or replicate a piece of code/xaml in every single control. I find it astounding that they have not fixed a bug of this magnitude.
Any ideas?
Cheers
So I haven't tried this, but it sounds like it would work. Also, the information is a bit dated. Please do let me know if it solves the problem. :)
From the Blend blog, add the following two chunks to your project files:
<DesignTime Condition="'$(SolutionPath)'!='' AND Exists('$(SolutionPath)')">true</DesignTime>
….
<ApplicationDefinition Condition="'$(DesignTime)'=='true' AND '$(BuildingInsideVisualStudio)'!='true' AND '$(BuildingInsideExpressionBlend)'!='true'" Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
Basically this includes your app.xaml conditionally into your project so it gets used at design time, but not at build time. I'm guessing they assume people use msbuild to produce production code rather than clicking the build compile button.
Seems like this bug disappears if you use DynamicResources instead.
Explained here in b): http://blogs.msdn.com/b/unnir/archive/2009/03/31/blend-wpf-and-resource-references.aspx
Someone posted this link in an earlier SO question on the same bug, but for some reason it got no upvotes and was lost below other answers.

Resources