Silverlight AutoSize and Visual Studio 2010 for Windows Phone - silverlight

I have designer using Blend to desing windows phone pages. It has d:DesignHeight and d:DesignWidth set.
I use Visual Studio 2010 Express for Windows Phone. Now if I open any .xaml file in DesignMode, it reset the DesignHeight and Width. It is really annoying as I have to manually change back those values before checking in my changes to sourceControl.
Saw this one WPF UserControl Design Time Size
but to do it in every page would be a stupidity for me.
Hope there is a switch in VS, which I am not aware of.
Any ideas please?
Update
I have the following:
SupportedOrientations="Landscape" Orientation="Landscape"
shell:SystemTray.IsVisible="True" d:DesignHeight="800" d:DesignWidth="480">
When I view in Design Mode it changes to
d:DesignHeight="480" d:DesignWidth="782">

The Windows Phone has a fixed Page size (480x800 pixels)
When you design a Page the designer determines the appropriate size in the designer by looking at the orientation of the page and the visibility of the SystemTray:
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="False">
My guess is that because you can only design Pages that are full screen, the designer keeps replacing custom set values for the height and width.
When creating a User Control (not a Page!) you are free to change the Height and Width any way you want.

Related

How to prevent overriding from button styles in WPF

out current application is a DevExpress Ribbon window. However, we have some legacy code - including a WPF Control which was hosted through a WinForms Window - with WPF Host. (please dont ask why)
I wanted to change the UserControl at least to a Wpf Window to get rid of WinForms.
Now here is my Problem: All stlyes get totally messed up. Especially my buttons have a problem:
The buttons lose their assigned Images, and also Background and Foreground is not assignable. Through the Live Visual Tree from Studio I see that it is overridden.
I guess the thing with images leads to the same root cause.
I dont want to redo the whole window again in DevExpress (if this is the cause).
Is there a way for a window to not use some application styles and run as default? Or how can I find out, what is actually overriding everything?
I finally found the solution. The DevExpress was overriding any styles of any form in application, settings something to the DevExpress.Xpf.CoreTemeManager.
To disable a style, I had to add the following thing to my window:
<Window x:Class="AnotherWindow"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
dx:ThemeManager.ThemeName="NoneName"
<!-- ...-->
</Window>
Also include DevExpress.Data and DevExpress.Xpf.Core references.

Ribbon Control showing Windows 2000 Minimise/Maximise/Close buttons

I'm trying to get a standard Ribbon Control working using VS 2010 on Windows XP. I've downloaded/installed the latest version of the Ribbon Control (October 2010) from the Microsoft Download Centre. From here I created a new project with the "WPF Ribbon Application" template.
The control itself works fine, but it seems to apply the Windows 2000 theme to the Minimise/Maximise/Close buttons, as can be seen in this screenshot:
I've tried changing the main window style to Aero in app.xaml (no effect on top right controls). I also tried (and failed) to set the Ribbon style to Office2007 (apparently the most recent version of the ribbon control has removed this feature).
Did I install something incorrectly? I installed both the *.msi files in the link. Am I missing a reference?
Any help would be much appreciated.
I figured it out, I know this is an old question but he this pops up in Google so for all the people that will see this in the future!
ANSWER DOWN HERE!!!
https://stackoverflow.com/a/21675624/3239917
Instead of the tags <ribbon:RibbonWindow on the beginning of the xaml,
Make it <Window .
Then in your class delete your : RibbonWindow
After that go back to your XAML, and change the Ribbon margin to -22 :
<r:Ribbon x:Name="Ribbon" prism:RegionManager.RegionName="RibbonRegion" Margin="0,-22,0,0" >

WPF: Do VS 2010 and Blend 4 really integrate well?

I'm new to WPF, so this is my first project.
I started with the coding side of things using VS. I am overall pretty satisfied with the way VS is used to build a WPF app, however a big part of WPF is also animation.
So to my relief, I was able to open the solution I created using VS 2010, in Expression Blend 4.
I opened it, but then I noticed the form design view in Blend 4. My heart sank. Please don't tell me WPF 4 is still so immature as a product that you cannot yet work decently with WPF projects created in VS 2010?
See the screen shots:
Here is good old VS 2010 form design view. As you can see there is a menu and a label control on the form.
Here on the other hand is the same form open in Blend 4:
As you can see, no design time support it seems for ANY existing elements. The form besides being black, seems to not contain my menu or label.
Have I done something wrong, or is Blend this immature?
My course of action seems to be learning the XAML and using pure VS 2010 for animation, but that means that Blend 4 would be a failed product in my eyes.
Update:
Here is the full screen , so this is after opening the MainWindow.xaml in Blend 4.
Ok well I figured it out.
I am guessing its also a bug in Blend 4.
In VS 2010 my Window visibility was initially hidden, this is because I have a custom splash screen which first loads, then sets the visibility to true.
So design mode imo of Blend should not pay attention to the Windows visibility property, this is a run time property really.
Setting the visibility to true of the form / window. and the results are better.

Winforms Richtextbox not properly rendered in WPF project

I have a very strange issue in my WPF project. The main window contains several wpf controls and winforms RichTextbox(don't ask me why) within WindowsFormsHost element.
Richtextbox contains text. In some cases Richtextbox is not properly rendered when loading window (the right part is white like somebody uses erase tool and clears a rectangle).
This situation is not so common (~20 users / 30 000) and it probably depends on hw. It occurs on XP machines. I have tried to force sw rendering, but it didn't help.
Application is built in .net 3.5 SP1.
Any idea?
The problem was caused by user's unusuall dpi settings in Window. Strange, but with normal values, it works

Visual Studio 2008, WPF Tabitem. How do I bring it to front?

I cannot figure out how to bring a TabItem to the front of a TabControl in a visual studio 2008 wpf project so that I can see the controls I'm editing.
The visual display part only ever shows the controls on the first TabItem. It does works in run time, just not in design time.
Sounds retarded, maybe I am, but I can't figure out how and I'd really appreciate if anyone could tell me how?
I've tried bringing things to the front, pushing things to the back? Clicking through document outline, looking through properties, double clicking, pulling my hair out, banging my head on the wall....
How can something so simple elude me? :(
Thank you.
Setting the IsSelected property on the TabItem works but it's obscure to say the least and kludgy at best.
This problem has in fact been fixed to work the way you would expect it to work since 8/11/2008 however Windows Update doesn't notify you that the update is available, not even if you check from the Visual Studio 2008 "Help>Check for Updates" menu item. I just ran across this issue myself as I was migrating to a new laptop where the Tab Control worked properly on my old machine but not on my new machine. On closer inspection I found that the difference was that the Visual Studio 2008 SP1 was missing, once I installed that the Tab Control started working properly again. Go to;
http://msdn.microsoft.com/en-us/vstudio/cc533448.aspx
This makes me wonder though, even before the update to VS2008 the Tab Control worked properly in Expression Blend and since the SP1 update was to VS2008, not to the .Net framework, the control shouldn't have changed. So, did Microsoft write the design time behavior for the Tab Control into the UI vs the control itself? That would be very wierd but how would it work in Blend and not VS2008 if the design time behavior was in the control? Maybe Blend and VS2008 each have their own set of control templates that handle design time behavior? You would think that the two programs would share them if they did. Hmmmm...
PS: Don't forget to install the 3 security updates to VS2008 SP1 that Windows Update finds now, 500MB holy cr_p batman.
Use the IsSelected property on the TabItem
<TabControl>
<TabItem Header="Tab1">
<TextBlock Text="This text is not visible"/>
</TabItem>
<TabItem Header="Tab2" IsSelected="True">
<TextBlock Text="This text is visible" />
</TabItem>
</TabControl>

Resources