WPF Inkcanvas cann't be seen after saving - wpf

I can write well. But WPF Inkcanvas can not be seen after saving in tablet.
but if i use another computer (not tablet), can write and see well.

Your question is not clear. Based on my understanding, I hope that is because the size of the tablet screen which is smaller than the desktop that makes the strokes to get hidden inside the area that was not visible on the tablet, However, the area is visible in Desktop.
Have the InkCanvas inside the Viewbox. I hope that will fix your issue.
<Grid>
<Viewbox Stretch="Fill">
<InkCanvas />
</Viewbox>
</Grid>

Related

Trying to wrap and scale text in a textblock WPF

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.

MediaElement audio/video out of sync when inside a ViewBox

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

Silverlight 4 ContextMenu and ScaleTransform

The ContextMenu provided by the Silverlight 4 Toolkit worked great until I implemented a
<RenderTransform> tag in my XAML in order to have the Silverlight app scale to fit the entire browser window (following this little tutorial)
When all worked great, before the tutorial, my XAML looked like:
<UserControl>
<Grid>
<!-- Rest of app here... -->
</Grid>
</UserControl>
Now, my app looks like:
<UserControl>
<Canvas>
<Canvas.RenderTransform>
<ScaleTransform [vars]></ScaleTransform>
</Canvas.RenderTransform>
<Grid>
<!-- Rest of app here... -->
</Grid>
</Canvas>
</UserControl>
The scaling works perfectly, but now when I right click, the ContextMenu doesn't appear where it should (under the mouse). Instead, it appears at the same x-position as the mouse, but it shows up at the very top of the app. It's also very buggy, I have to keep clicking around to get it to go away, and I can't right click somewhere else to bring it up again, and it doesn't scale along with the rest of the app.
What might be causing this? Is there a correct way to go about fixing this, or should I just apply an offset to the menu to move it to the mouse?
You will need to pass the cursor coordinates through the inverse of your scale transformation to convert the screen point to a point your application understands.

Set whole background image/colour in WP7

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.

Vertical scrolling in silverlight

I have a silverlight application that is set to use 100% browser height.
As I dynamically add controls to a canvas (which can be dragged around), I would like the expand the canvas vertically.
Ideally show the browser scrollbar so the user can move up or down, if that can't be done, use the scrollbar control. I would also need to handle the user changing the size of the browser. Any suggestions on how to do this ?
Cheers,
Just wrap your Canvas inside of a ScrollViewer as follows:
<ScrollViewer>
<Canvas>
...
</Canvas>
</ScrollViewer>
Jim McCurdy
Face to Face Software and YinYangMoney

Resources