Edit a scroll viewer in the design view of visual studio 2010 - c#

I have an input form that I want to edit in visual studios design view. The form is placed within a scroll viewer but since the form is so long I can figure out how to actually scroll the scroll viewer so I can edit further down in the form since the design window is only showing what fits in the window size. Is it possible to edit the entirety of the scroll viewer?

You can either put the form into a UserControl and edit it there without scrollbars or you can increase the size of the Window at design time but leave it at its normal size at run-time. You can achieve the latter effect by adding this to your XAML file:
<Window ...
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
...
d:DesignHeight="1000" d:DesignWidth="1000">

Related

GMap.Net for WPF Map Position is not updating when Zooming

My WPF application UserControl contains a GMap control.
<UserControl x:Class="Test.test.Map"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gmmapeprovider="clr-namespace:GMap.NET.MapProviders;assembly=GMap.NET.Core"
xmlns:prism="http://prismlibrary.com/"
xmlns:windowspresentation="clr-namespace:GMap.NET.WindowsPresentation;assembly=GMap.NET.WindowsPresentation" prism:ViewModelLocator.AutoWireViewModel="True">
<Grid >
<windowspresentation:GMapControl
x:Name="mapView" MinZoom="1"
Position="{Binding MapPosition}"
MaxZoom="17"
Zoom="{Binding MapZoom}"
MouseWheelZoomEnabled="True"
MouseWheelZoomType ="MousePositionWithoutCenter"
MapProvider="{x:Static gmmapeprovider:GoogleMapProvider.Instance}"
CacheLoc="{Binding XmlFilePath}"
IgnoreMarkerOnMouseWheel="True"/>
</Grid>
</UserControl>
The Map Position is bound to MapPosition Property in the UserControl's ViewModel. Each time I Pan the Map using the right mouse button, click and drag function, the value of the MapPosition is updated.
Here's my concern:
My expectation is the value of the Position should also be updated if the map is zoomed, while the mouse pointer is not on the center of the control. Apparently, this is not the case, the Position remains unchanged, unless if the map is panned once more.
Am I missing some settings here, or are there any possible workaround for this issue?
I have checked the source code, starting from line 1740 until 1748, it turns out that the very _core._position is the one being updated instead of the GMapControl.Position during MouseWheel Zooming. which means that the UI control itself does not know that the position was been changed apparently.
here's the pull request I have made, hopefully, it gets by the owner.
I have just replaced the _core._position to Position.

Resize windows size according to title length.

I have a window (WPF) which has a long title. When the size of window is increased dynamically, the title is shown properly. In one case size of window decreased dynamically. In that case full title is not shown. I want to resize the window according to title or textwrap the title, so that full title will be shown. Is there any solution for this?
<Window x:Class="Viewer.View.SelectorWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
Icon="pack://application:,,,/Images/Viewer.png" WindowStartupLocation="CenterOwner" ResizeMode="CanMinimize"
Title="Registration and visualization from multiple data sets" Height="450" SizeToContent="Width"
>
I don't think that this approach will lead to great success without a lot of effort. Consider the following problems:
Do you really want to fit your window size depending on the title length? If the title is really really long, you are creating a really really big window just because of the title.
It's not that intuitive to put much information into window title
If it's possible to realize at all, you probably have to dig deeper than simply setting some WPF properties.
My solution would be to simply display the title in your view. A simple TextBlock that binds to the window title. So you are much more flexible.

Prevent resizing of page window in WPF

I have a WPF app that is set to a specific size for a reason. However the user still has the ability to resize the page. I have set all the maximum page sizes and have achieved three different results, none of which suit my need.
1) The window goes full screen with my app in the top left corner. The rest of the screen is filled with the page background colour.
2) The window goes full screen, page stays central and the rest of the screen is filled with white space.
3) This is the worst solution... The window resizes and shows all the junk i have lying around outside of the page!
All i want to do is prevent someone from changing the window size at all! I am new to wpf and especially new to xaml so want time to learn how to set up auto resizing properly. unfortunately now is not that time (deadlines!).
Thanks
All i want to do is prevent someone from changing the window size at all!
Set the ResizeMode property of the Window to NoResize then:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication1"
mc:Ignorable="d"
Title="Window13" Height="300" Width="300" ResizeMode="NoResize">
...
If you do want the user to be able to resize the window it can never have a fixed size...

Place WPF Popup Along Bottom of Screen

I have a Popup that consists of a grid of labels. The popup sits inside a Canvas like this.
<Canvas x:Name="mainCanvas">
<Popup x:Name="mainPopup"
IsOpen="True"
PlacementTarget="{Binding ElementName=mainCanvas}"
PopupAnimation="Fade"
AllowsTransparency="True"
Placement="Center">
Wrapping inside the canvas (or similar control) is the only way I've found to allow the popup's contents to be transparent.
Anyway, all of this works fine and I see my grid of labels across the center of the screen. What I'd really want though is to display the grid of labels across the bottom of the screen. However when I change Placement="Center" to Placement="Bottom", I don't see the popup at all.
Have you seen this? It is a pretty good explanation about how popup placement works.
I created a test WPF project in Blend and pasted your exact code, then changed Placement to Bottom. I did see the content I added to the popup (a TextBlock with some junk text), but it was hard to see, since it is positioned below mainCanvas (as expected).
So... there must be some other problem aside from the code you showed.

Non-resizable windows with windowStyle=None

Basically, I want to create a window that looks like the following:
alt text http://www.thex9.net/screenshots/2009-10-15_1347.png
However, the window shouldn't be resizable (the one in the screenshot is) but must retain the glass border. The XAML for the window in the screenshot is as follows:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication1.MainWindow"
x:Name="Window" Title="MainWindow" WindowStyle="None">
<Grid x:Name="LayoutRoot"/>
</Window>
Is it possible to create a window which looks similar to the one in my screenshot but is not resizable? Any help would be very much appreciated.
Probably you can get desired result by:
ResizeMode=
XAML object property which can take have following states:
NoResize - A window cannot be resized. The Minimize and Maximize buttons are not displayed in the title bar.
CanMinimize - A window can only be minimized and restored. The Minimize and Maximize buttons are both shown, but only the Minimize button is enabled.
CanResize - A window can be resized. The Minimize and Maximize buttons are both shown and enabled.
CanResizeWithGrip - A window can be resized. The Minimize and Maximize buttons are both shown and enabled. A resize grip appears in the bottom-right corner of the window.
One way to accomplish a fixed size Window while retaining the border is to set the Min[Width|Height] and Max[Width|Height] properties to be the same value. The border will still show the resize cursor, but the user will not be able to change the size of the Window.
If the fact that the border still indicates that it's resizable bothers you, the next step is to set the ResizeMode="NoResize", but then you have to start drawing your own Aero glass if you want to retain the glass edges.

Categories