我是WPF和XAML的新手。 我想将进度条元素移动到特定区域,但它不会移动。我在谷歌搜索了最后一小时,没有找到任何解决方案。
Picture of GUI http://image.prntscr.com/image/f5badb35ca994cf892bfea4384a276e4.png
XAML代码:
<Window x:Class="ArduinoSMS_sender.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:ArduinoSMS_sender"
mc:Ignorable="d"
WindowStartupLocation="CenterScreen"
Title="SendMEEE" Height="506" Width="750" KeyDown="Window_KeyDown" ResizeMode="CanMinimize">
<Grid>
<DockPanel>
<Menu DockPanel.Dock="Top">
<MenuItem Header="File">
<MenuItem Header="Open" Click="menu_open_Click"/>
<MenuItem Header="Save" Click="menu_save_Click"/>
<MenuItem Header="Import" Click="menu_import_Click"/>
<MenuItem Header="Export" Click="menu_export_Click"/>
</MenuItem>
</Menu>
<StackPanel Height="457" VerticalAlignment="Bottom">
<ProgressBar Height="10" Width="100"/>
</StackPanel>
</DockPanel>
<ListView x:Name="osebe_listView" HorizontalAlignment="Left" Height="319" Margin="30,83,0,0" VerticalAlignment="Top" Width="310" SelectionMode="Multiple" SelectionChanged="osebe_listView_SelectionChanged" d:IsLocked="True">
<ListView.View>
<GridView>
<GridViewColumn Header="Naziv podjetja" DisplayMemberBinding="{Binding nazivPodjetja}"/>
<GridViewColumn Header="Ime" DisplayMemberBinding="{Binding ime}"/>
<GridViewColumn Header="Priimek" DisplayMemberBinding="{Binding priimek}"/>
<GridViewColumn Header="Naslov" DisplayMemberBinding="{Binding naslov}"/>
<GridViewColumn Header="Pošta" DisplayMemberBinding="{Binding posta}"/>
<GridViewColumn Header="Mobilna številka" DisplayMemberBinding="{Binding mobilnaSt}"/>
<GridViewColumn Header="Stacionarna številka" DisplayMemberBinding="{Binding stacionarnaSt}"/>
<GridViewColumn Header="E-naslov" DisplayMemberBinding="{Binding eMail}"/>
<GridViewColumn Header="Skupina" DisplayMemberBinding="{Binding skupina}"/>
</GridView>
</ListView.View>
</ListView>
<Button x:Name="urediSkupine_btn" Content="Manage groups" HorizontalAlignment="Left" Margin="248,19,0,0" VerticalAlignment="Top" Width="92" Click="urediSkupine_btn_Click" d:IsLocked="True"/>
<ComboBox x:Name="izbranaSkupina_cbx" HorizontalAlignment="Left" Margin="30,19,0,0" VerticalAlignment="Top" Width="120" d:IsLocked="True"/>
<Button x:Name="izberiOsebeSkupine_btn" Content="Select people" HorizontalAlignment="Left" Margin="155,19,0,0" VerticalAlignment="Top" Width="88" Click="izberiOsebeSkupine_btn_Click" d:IsLocked="True"/>
<Button x:Name="dodajOsebo_btn" Content="Add contact" HorizontalAlignment="Left" Margin="30,56,0,0" VerticalAlignment="Top" Width="75" Click="dodajOsebo_Click" d:IsLocked="True"/>
<Button x:Name="urediOsebo_btn" Content="Edit" HorizontalAlignment="Left" Margin="190,56,0,0" VerticalAlignment="Top" Width="75" Click="urediOsebo_btn_Click" d:IsLocked="True"/>
<Button x:Name="zbrisiOsebo_btn" Content="Delete" HorizontalAlignment="Left" Margin="110,56,0,0" VerticalAlignment="Top" Width="75" Click="zbrisiOsebo_btn_Click" RenderTransformOrigin="1.067,0.682" d:IsLocked="True"/>
<TextBox x:Name="isci_tb" HorizontalAlignment="Left" Height="23" Margin="30,423,0,0" TextWrapping="Wrap" Text="search" VerticalAlignment="Top" Width="120" BorderThickness="0, 0, 0, 1" TextChanged="isci_tb_TextChanged" d:IsLocked="True" >
<TextBox.Background>
<ImageBrush/>
</TextBox.Background>
</TextBox>
<TextBox x:Name="izbraniKontakti_tb" Focusable="False" HorizontalAlignment="Left" Height="23" Margin="187,423,0,0" TextWrapping="Wrap" Text="Selected: " VerticalAlignment="Top" Width="120" BorderThickness="0, 0, 0, 1" d:IsLocked="True" >
<TextBox.Background>
<ImageBrush/>
</TextBox.Background>
</TextBox>
<RichTextBox x:Name="smsText_rtb" HorizontalAlignment="Left" Height="319" Margin="423,83,0,0" VerticalAlignment="Top" Width="309" d:IsLocked="True">
<FlowDocument/>
</RichTextBox>
<Button x:Name="shraniSporocilo_btn" Content="Save" HorizontalAlignment="Left" Margin="472,47,0,0" VerticalAlignment="Top" Width="75" Click="shraniSporocilo_btn_Click" d:IsLocked="True"/>
<Button x:Name="odpriSporocilo_btn" Content="Load" HorizontalAlignment="Left" Margin="585,47,0,0" VerticalAlignment="Top" Width="75" Click="odpriSporocilo_btn_Click" d:IsLocked="True"/>
<Button x:Name="poslji_btn" Content="Send" HorizontalAlignment="Left" Margin="540,423,0,0" VerticalAlignment="Top" Width="107" Height="37" Click="poslji_btn_Click" d:IsLocked="True"/>
<Button x:Name="izberiVse_btn" Content="S" HorizontalAlignment="Left" Margin="282,56,0,0" VerticalAlignment="Top" Width="25" RenderTransformOrigin="5.87,0.364" Height="22" Click="izberiVse_btn_Click" d:IsLocked="True"/>
<Button x:Name="odstraniIzbor_btn" Content="D" HorizontalAlignment="Left" Margin="317,56,0,0" VerticalAlignment="Top" Width="22" RenderTransformOrigin="5.87,0.364" Click="odstraniIzbor_btn_Click" d:IsLocked="True"/>
<Label x:Name="status_lbl" Content="Status: nepovezan" HorizontalAlignment="Left" Margin="0,446,0,-2" VerticalAlignment="Top" d:IsLocked="True"/>
</Grid>
请帮助。
答案 0 :(得分:1)
使用HorizontalAlignment&amp; amp;检查发送按钮的定位方式。 VerticalAlignment&amp;保证金属性。
StackPanel不是必需的&amp; ProgressBar应该从DockPanel移动到主Grid。
这样的东西应该靠近你的发送按钮
....
....
<Button x:Name="odstraniIzbor_btn" Content="D" HorizontalAlignment="Left" Margin="317,56,0,0" VerticalAlignment="Top" Width="22" RenderTransformOrigin="5.87,0.364" Click="odstraniIzbor_btn_Click" d:IsLocked="True"/>
<Label x:Name="status_lbl" Content="Status: nepovezan" HorizontalAlignment="Left" Margin="0,446,0,-2" VerticalAlignment="Top" d:IsLocked="True"/>
<ProgressBar Height="10" HorizontalAlignment="Left" Margin="423,423,0,0" VerticalAlignment="Top" Width="100"/>