I have a wpf application that constantly produces odd straight lines (grey) across the screen.
As the mouse moves around they appear and disappear.
Sorry for the bad description but its hard to describe.
I wonder if there is anything I can do about it.
I have tried a few rendering options and so forth.
<dxg:GridControl SnapsToDevicePixels="True"
and
RenderOptions.ClearTypeHint="Enabled"
RenderOptions.BitmapScalingMode="NearestNeighbor"
RenderOptions.EdgeMode="Aliased"
We have similar issues with big black vertical bars. Only resolved by switching to software only rendering:
System.Windows.Media.RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
Related
I'm trying to auto scale the font and wrap text in a TextBlock in WPF and I can't figure it out.
I've Googled it and looked at stackoverflow loads of times and the main suggestion is to place a TextBlock inside a ViewBox. I've tried that, and all it does is scale the whole text down to one line instead of wrapping it.
If I just use a TextBlock without a ViewBox it wraps, but doesn't scale to fit. It's driving me mad, as I am literally trying to move from WinForms to WPF to make better looking UIs.
I've tried StackPanel and DockPanel and they still don't have the desired effect.
All I want is a TextBlock to take a string of text of unknown size and display it scaled and wrapped. I don't understand why it's so difficult
It is helpful to include code of what you have tried.
When I do this:
<Grid>
<TextBox VerticalAlignment="Center" TextWrapping="Wrap" Width="100"/>
</Grid>
I get this:
Is that what you are looking for?
You could also check out the RichTextBox if you need more features.
I'm using Viewbox controls to proportionally size content in my app at a certain display size. I don't know what the display size of the target computer will be, but I need the app's layout, fonts, graphics, etc to look the same on the target computer as on my machine. Viewbox has worked great for me in the past to accomplish this.
However, when I include a MediaElement (to play a WMV) inside the Viewbox, the media's audio and video get out of sync. The video lags behind, then speeds up, then lags behind, then speeds up, etc.
My actual layout looks something like this:
<Grid>
<Viewbox>
<Grid Width="888" Height="500"> <!-- 16:9 screen size -->
<!-- row definitions -->
<Viewbox Grid.Row="1">
<Grid>
<custom:TransitionFrame />
<!-- TransitionFrame inherits from Frame -->
<!-- TransitionFrame holds a Page that
looks like this:
<Grid>
<MediaElement />
</Grid>
-->
</Grid>
</Viewbox>
</Grid>
</Viewbox>
</Grid>
Any ideas on why this would impact the video? Any ideas on how to resolve it?
Ugh. This has caused me sooooooo much issues. Its really depends on the machine. I have a pretty solid development machine and have never seen any issues. Then I ran the application on another normal machine and it was choppy as hell. I had to play with the following settings:
Switching monitors
Switching screen refresh rates
Switching resolution
Switching graphic cards.
Then when I got the out-of sync issues to < 500ms I created another layout and put in an option saying low graphics and it played fine. I made the other layout very basic with no more than one ViewBox.
I recommend staying away from Viewboxes with MediaElements
I'm using WPF xaml. When i do a debug, the pictures ran out of place from what the design is shown. Any one know why? Beside codes what do i have to add in? Sry first time posting in here. What else must i add on? Btw i'm using VS2010.
<Grid>
<Image Source="C:TV\TV_Page_02.jpg" UseLayoutRounding="True"></Image>
<Image Source="C:TV\2.jpg" UseLayoutRounding="True" Margin="19,74,115,72"></Image>
<Image Source="C:TV\1.jpg" UseLayoutRounding="True" Margin="123,53,47,72"></Image>
</Grid>`
Allright, here's the issue:
"Layout rounding should be used in UI scenarios where the exact location of objects can be sacrificed for overall appearance of the application. Since rounding of layout parameters occurs when using this feature, precise element placement is lost. A few of the effects layout rounding can have on exact layout are…
·width and or height of elements may grow or shrink by at most1 pixel
· placement of an object can move by at most 1 pixel
· centered elements can be vertically or horizontally off center by at most1 pixel
If your app has an unexpectedly blurry image or icon, fuzzy lines or borders that should be crisp, or grid banding try using layout rounding." - Quoted from "WPF Text Blog".
Here's the link to read more about this property:
http://blogs.msdn.com/b/text/archive/2009/08/27/layout-rounding.aspx
Now I guess we now what is the problem (UseLayoutRounding=true). Just remove this property
I can't seem work out (even though I have seen other apps) how to set the whole background of a WP7 page to a image or colour, like in Panorama for example.
If i set
Grid x:Name="LayoutRoot" Background="#FF0079C1"
Or
<Grid.Background>
<ImageBrush ImageSource="/images/highwaysBack.jpg" Stretch="None" />
</Grid.Background>
it still leaves the top info section either black or white depending on the phone setting.
Many thanks.
That's most likely the System Tray. You can hide that by setting shell:SystemTray.IsVisible="False" on your page.
Make a note that hiding the system tray isn't something you always want to do, as you're hiding info like the battery life. Only do it because you app absolutely has to, like a video game. If it's just a simpler app there shouldn't be a real neeed to hide it.
I created a custom control similar to TabControl. It works nice, except that the text in header items gets blury when I resize the content. It can, for example look like this:
Not only the text, but the box around the text can also get non-vertical. See the blue border around the "General" item:
What is causing this problem? I have set SnapToDevicePixels = True.
Thanks for any ideas!
EDIT:
I'm using .NET 4.0. TextOptions.TextFormattingMode is set to "Display".
The whole problem with fuzzy text and background occurs if I apply a DropShadowEffect effect in the style for ItemsControl which displays the buttons. This is the code for the Effect:
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect Direction="0" ShadowDepth="1" BlurRadius="10" Opacity="0.2" Color="Black" />
</Setter.Value>
</Setter>
If this code is not enabled, the the text and the borders get displayed nicely.
I suspect you've said it yourself: SnapToDevicePixels will ruin text rendering if you've resized the text so it displays across pixels. You probably want to keep SnapToDevicePixels="True" on your borders/backgrounds, but turn it off for the text elements.
As for your border... can you post the xaml? I'm guessing that you're not using just a single element with rounded corners - are you drawing the edge of that tab as three separate lines?
There are 2 things to consider:
are you using .NET 3.5 or .NET 4.0? reason why I'm asking is that the text rendering has been changed between the versions. In 4.0 it's a lot better.
Sometime you have to wait a little while until the text get's sharper, so you scroll around, and then after a second the text becomes sharper. That could be as well a reason for you're issue.