我正在使用Microsoft Visual Studio 2010,wpf应用程序,其中包括参考动态数据显示地图。如何将菜单拉伸至整个窗口
第一,这是我的项目看起来如何:
我想控制的对象,标签,尤其是在工具栏,我希望工具栏被拉伸所有屏幕水平。它不起作用。 属性horizontalAligment是“Stretch”。 不知道如何解决它。 在XAML中有我的代码:
<Window x:Class="MapSample.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d3="http://research.microsoft.com/DynamicDataDisplay/1.0"
Title="כוכב בוהק"
HorizontalContentAlignment="Center"
mc:Ignorable="d"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="702"
SizeToContent="Manual"
d:DesignWidth="983"
WindowState="Maximized" >
<Grid Cursor="Hand"
Height="704"
Width="807">
<Grid.RowDefinitions>
<RowDefinition Height="253*" />
<RowDefinition Height="451*" />
</Grid.RowDefinitions>
<Menu Cursor="Hand"
DockPanel.Dock="Top"
Margin="0,0,12,185"
HorizontalContentAlignment="Stretch"
FlowDirection="RightToLeft"
VerticalContentAlignment="Stretch"
Background="Gainsboro"
FontWeight="Normal">
<MenuItem Header="קובץ" FontWeight="Bold" FontSize="14">
<MenuItem Name="Open"
Header="פתח">
<MenuItem.ToolTip>
פתח קובץ.
</MenuItem.ToolTip>
</MenuItem>
<MenuItem Name="Save"
Header="שמור">
<MenuItem.ToolTip>
שמור קובץ.
</MenuItem.ToolTip>
</MenuItem>
<MenuItem Name="Options"
Header="הגדרות">
<MenuItem.ToolTip>
הצג הגדרות.
</MenuItem.ToolTip>
</MenuItem>
<MenuItem Name="Close"
Header="סגור">
<MenuItem.ToolTip>
סגור תוכנית זו.
</MenuItem.ToolTip>
</MenuItem>
</MenuItem>
<MenuItem Header="יצירה"
FontWeight="Bold"
FontSize="14">
<MenuItem Header="יצירת גרפים" >
<MenuItem Name="CreatGraph"
Header="גרף המציג זמן כפונקציה של דיוק" />
<MenuItem Name="CreatGraph2"
Header=" גרף המציג איכונים העוברים את המפרט מתוך כלל האיכונים שנורו" />
<MenuItem Name="CreatGraph3"
Header=" גרף המציג זמן כפונקציה של מרחק מהמכ'ם למסלול הירי" />
<MenuItem Name="CreatGraph4"
Header=" 'גרף המציג את גרף א' וגרף ג" />
</MenuItem>
<MenuItem Header="יצירת מפות">
<MenuItem Name="CreatMap1"
Header="מפה שתציג נ'צ הנפילה האמיתית מול נ'צ נקודת חיתוך התצפיתנים והמרחק בינהם" />
<MenuItem Name="CreatMap2"
Header=" מפה שתכיל את המכ'ם, האיכון שהתקבל, מיקומי התצפיתנים והאזימוטים שלהם" />
</MenuItem>
</MenuItem>
</Menu>
<d3:ChartPlotter Name="plotter" Visible="-180,-90,360,180" Height="470" Width="700"
MouseLeftButtonDown="plotter_MouseLeftButtonDown"
MouseRightButtonDown="plotter_MouseRightButtonDown"
Margin="54,117"
Grid.RowSpan="2">
<d3:ChartPlotter.DataTransform>
<d3:MercatorTransform/>
</d3:ChartPlotter.DataTransform>
<d3:Map>
<d3:OpenStreetMapServer/>
</d3:Map>
<d3:CursorCoordinateGraph Cursor="Pen"
OpacityMask="Black" />
<d3:AxisCursorGraph/>
</d3:ChartPlotter>
<Label Content=":תוצאות "
Height="136"
HorizontalAlignment="Left"
Margin="-160,118,0,0"
Name="lbl_resualt_measurement"
VerticalAlignment="Top"
Width="196"
HorizontalContentAlignment="Right"
Grid.RowSpan="2" />
<Button Content="הכנס נקודה"
Height="23"
HorizontalAlignment="Right"
Margin="0,74,110,0"
Name="btn_InsertPoint"
VerticalAlignment="Top"
Width="78"
Click="btn_insertPoint_Click"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center" />
<TextBox Visibility="Collapsed"
Height="23"
HorizontalAlignment="Left"
Margin="317,74,0,0"
Name="txt_Vertical"
VerticalAlignment="Top"
Width="143"
Text="הכנס תחום בציר האנכי"
GotFocus="txt_Vertical_GotFocus"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center" />
<TextBox
Visibility="Collapsed"
Height="23"
HorizontalAlignment="Left"
Margin="466,74,0,0"
Name="txt_Horizental"
VerticalAlignment="Top"
Width="143"
Text="הכנס תחום בציר האופקי"
GotFocus="txt_Horizental_GotFocus"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center" />
<Label Content=":אזימוטים מתקבלים "
Height="86"
HorizontalAlignment="Left"
Margin="-160,39,0,0"
Name="lbl_Azimuth"
VerticalAlignment="Top"
Grid.Row="1"
Width="201"
HorizontalContentAlignment="Right" />
<Image Height="35"
HorizontalAlignment="Left"
Margin="665,26,0,0"
Name="PushPinImage"
Stretch="Uniform"
VerticalAlignment="Top"
Width="30"
Source="/MapSample;component/Images/Push_Pin1.png"
MouseLeftButtonDown="PushPinImage_MouseLeftButtonDown" />
<Image Height="35"
HorizontalAlignment="Right"
Margin="0,26,149,0"
Name="PolygonImage"
Stretch="Uniform"
VerticalAlignment="Top"
Width="39"
Source="/MapSample;component/Images/Maps-Polygon-icon.png"
MouseLeftButtonDown="PolygonImage_MouseLeftButtonDown" />
<Image Height="35"
HorizontalAlignment="Left"
Margin="572,26,0,0"
Name="MesurmentImage"
Stretch="Uniform"
VerticalAlignment="Top"
Width="41"
Source="/MapSample;component/Images/Mesurment.ico"
MouseLeftButtonDown="MesurmentImage_MouseLeftButtonDown" />
<Image Height="40"
HorizontalAlignment="Left"
Margin="524,24,0,0"
Name="RadiusImage"
Stretch="Uniform"
VerticalAlignment="Top"
Width="42"
Source="/MapSample;component/Images/CircleCR.png"
MouseLeftButtonDown="RadiusImage_MouseLeftButtonDown" />
</Grid>
</Window>
谢谢。
请勿设置网格的Width属性。你需要菜单的保证金属性吗? – Fratyx 2014-10-01 17:13:30