Click here to Skip to main content
15,886,919 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Enter key invokes button click Pin
GrooverFromHolland24-Jul-16 0:19
GrooverFromHolland24-Jul-16 0:19 
GeneralRe: Enter key invokes button click Pin
Mycroft Holmes24-Jul-16 14:34
professionalMycroft Holmes24-Jul-16 14:34 
QuestionUsing negative height margin values to properly vertically align a control Pin
Stephen Holdorf22-Jul-16 14:22
Stephen Holdorf22-Jul-16 14:22 
AnswerRe: Using negative height margin values to properly vertically align a control Pin
Stephen Holdorf23-Jul-16 4:50
Stephen Holdorf23-Jul-16 4:50 
GeneralRe: Using negative height margin values to properly vertically align a control Pin
Stephen Holdorf23-Jul-16 9:47
Stephen Holdorf23-Jul-16 9:47 
QuestionList Control Question Pin
Kevin Marois21-Jul-16 14:36
professionalKevin Marois21-Jul-16 14:36 
AnswerRe: List Control Question Pin
Gerry Schmitz22-Jul-16 11:18
mveGerry Schmitz22-Jul-16 11:18 
QuestionKeeping correct layout when browser is resized Pin
Stephen Holdorf17-Jul-16 3:37
Stephen Holdorf17-Jul-16 3:37 
I have a XAML window that the layout is done using a main grid. The problem is when the browser is resized the controls in the second and third columns move to the right and the window's layout is no longer correct. I have pasted the XAML below. I think the layout of a WPF window should be grid based with all controls residing in the window's master grid. Is this the proper layout design for WPF or is there a different recommended layout pattern? Also, I find myself having to use negative value in margins. This confuses me greatly as well.

XML
<Window x:Class="MasterPage.Intake1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:v="clr-namespace:MasterPage.View"
    Title="Intake 1" Height="900" Width="1000" Background="#FFD9DDE8" >
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="35*"/>
                <RowDefinition Height="45*"/>
                <RowDefinition Height="190*"/>
                <RowDefinition Height="275*"/>
        </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="500*"/>
                <ColumnDefinition Width="300*"/>
                <ColumnDefinition Width="250*"/>
            </Grid.ColumnDefinitions>
            
       <StackPanel Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0">
            <Image Source="Images\header.jpg" Height="47" Margin="0,0,0,0" />
      </StackPanel>
      <StackPanel HorizontalAlignment="Left" Grid.Column="0" Height="80"  Width="350" Grid.ColumnSpan="1" Grid.Row="1"  Margin="0,-23,0,0">
            <Image Source="Images\DSPASS_logo.png" Stretch="Fill" DockPanel.Dock="Top" Height="70" />
      </StackPanel>
        <StackPanel Grid.Column="4" Grid.Row="1" Grid.ColumnSpan="1" Margin="0,0,0,0">
        <TextBlock FontSize="15" Margin="0,0,0,0" Height="25" Width="300" TextWrapping="WrapWithOverflow">
            <Label FontSize="10" Name="Namelabel" Width="250" FontWeight="Bold" Foreground="#1664A1" Content="Welcome to DS PASS:"/>               
        </TextBlock>
      </StackPanel>
        <StackPanel Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="10,10,0,0" Height="290" Width="975" VerticalAlignment="Top" Grid.ColumnSpan="3" Grid.RowSpan="1">
            <Label Height="36" FontSize="16" Content="Post Identification" Background="#FF014E7E" FontWeight="Bold" Foreground="White" Margin="-5,0,-18,0"/>
            <StackPanel x:Name="_wordLength" Orientation="Horizontal" Margin="235,0,200,0">
                <TextBlock Height="20" x:Name="ApplicantType_TextBlock" Text="Applicant Type" Width="110" Margin="5" TextAlignment="Right"/>
                <ComboBox Height="25" x:Name="textBoxWordLength" Width="400" Margin="10,5"/>
            </StackPanel>
            <StackPanel x:Name="_integerWordLength" Orientation="Horizontal" Margin="235,0,200,0">
                <TextBlock Height="20" x:Name="textBlockIntegerWordLength" Text="Person Type" Width="110" Margin="5" TextAlignment="Right"/>
                <ComboBox Height="25" x:Name="textBoxIntegerWordLength" Width="400" Margin="10,5"/>
            </StackPanel>
            <StackPanel x:Name="_Post" Orientation="Horizontal" Margin="235,0,200,20">
                <TextBlock Height="20" x:Name="Post_TextBlock" Text="Post" Width="110" Margin="5" TextAlignment="Right"/>
                <ComboBox Height="25" x:Name="Post_TextBox" Width="400" Margin="10,5"/>
            </StackPanel>
        </StackPanel>
        <StackPanel Grid.Column="0" Grid.Row="3" HorizontalAlignment="Left" Height="130" Margin="15,-120,0,0" VerticalAlignment="Top" Grid.ColumnSpan="3" >
            <Label Height="36" FontSize="16" Content="Applicant Employment" Background="#FF004A78" FontWeight="Bold" Foreground="White" Margin="-5,0,-18,0"/>
                    <StackPanel x:Name="_max1" Orientation="Vertical" Margin="1,0,355,0">
                        <TextBlock Height="20" x:Name="maxTextBlock1" Text="Employee ID" Width="100" Foreground="Black" Margin="0,15,459,5" TextAlignment="Right"/>
                        <TextBox Height="25" x:Name="maxTextBox1" Width="400" Margin="0,-5,90,25"/>
                    </StackPanel>
        </StackPanel>
        <StackPanel Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="3" Orientation="Vertical" HorizontalAlignment="Left" Height="330" Margin="0,10,0,0" VerticalAlignment="Top" Width="965" Grid.RowSpan="2">
                <Label Height="36" FontSize="16" Content="English Version of Name" Background="#FF005183" Grid.Row="4" FontWeight="Bold" Margin="10,10,0,0" Foreground="White" Padding="4,5,5,5"/>
                    <StackPanel x:Name="_LastName" Orientation="Vertical">
                    <TextBlock Height="20" x:Name="LastName_TextBlock" Text="Last Name/Surname" Margin="55,5,459,5" TextAlignment="Left"/>
                    <TextBox Height="25" x:Name="LastName_TextBox" Width="500" Margin="55,5,459,5"/>
                    </StackPanel>
                    <StackPanel x:Name="_FirstName" Orientation="Vertical">
                    <TextBlock Height="20" x:Name="FirstName_TextBlock" Text="First Name" Margin="55,0,459,0" TextAlignment="Left"/>
                    <TextBox Height="25" x:Name="FirstName_TextBox" Width="500" Margin="55,0,459,0"/>
                    </StackPanel>
                    <StackPanel x:Name="_MiddleName" Orientation="Vertical">
                        <TextBlock Height="20" x:Name="MiddleName_TextBlock" Text="Middle Name" Margin="55,5,459,5" TextAlignment="Left"/>
                    <TextBox Height="25" x:Name="MiddleName_TextBox" Width="500" Margin="55,5,459,5"/>
                    </StackPanel>
                    <StackPanel x:Name="_ExtendedName" Orientation="Vertical">
                        <TextBlock Height="20" x:Name="ExtendedName_TextBlock" Text="Extended name (Tribal, Jr., III, etc.)" Margin="55,5,372,5" TextAlignment="Left"/>
                    <TextBox Height="25" x:Name="Extended_TextBox" Width="500" Margin="55,5,459,5"/>
                    </StackPanel>
                </StackPanel>
                <StackPanel Grid.RowSpan="4" Grid.Column="4" HorizontalAlignment="Left" Height="230" Margin="-250,400,0,0" Width="480" Grid.ColumnSpan="1">
                    <StackPanel x:Name="_Aliases" Orientation="Vertical" Margin="-15,0,0,0" Height="144">
                        <TextBlock Height="20" x:Name="Aliases_TextBlock" Text="Aliases" Margin="40,-5,0,5" TextAlignment="Left"/>
                        <TextBox Height="25" x:Name="Aliases_TextBox" Width="500" Margin="43,5"/>
                        <TextBox Height="25" x:Name="Aliases_TextBox1" Width="500" Margin="43,5"/>
                        <TextBox Height="25" x:Name="Aliases_TextBox2" Width="500" Margin="43,5"/>
                    </StackPanel>
        </StackPanel>

        <!--<Label HorizontalAlignment="Left" Margin="4,132,0,0" Grid.Row="3" VerticalAlignment="Top" Background="#FF72C772" Grid.ColumnSpan="3" Width="1242" Height="36"/>
        <Button Content="Continue" Grid.Column="2" HorizontalAlignment="Left" Margin="16,139,0,0" Grid.Row="3" VerticalAlignment="Top" Width="125" Click="Page1_Continue_Click"/>
        <Button Content="Save Draft" Grid.Column="1" HorizontalAlignment="Left" Margin="336,139,0,0" Grid.Row="3" VerticalAlignment="Top" Width="125"/>-->
        <Label HorizontalAlignment="Left" Margin="4,400,0,0" Grid.Row="4" VerticalAlignment="Top" Background="#FF52BB52" Grid.ColumnSpan="3" Width="983" Height="36">
        </Label>
        <Button Content="Save Draft" Grid.Column="1" HorizontalAlignment="Left" Margin="150,408,0,0" Grid.Row="5" VerticalAlignment="Top" Width="125" />
        <Button x:Name="ContinueButton_Page2" Content="Continue" Grid.Column="1"  Width="125" Grid.Row="5" VerticalAlignment="Top"  Margin="200,408,0,0" Grid.ColumnSpan="2" Click="btnContinue_Click"/>
    </Grid>
</Window>


modified 17-Jul-16 10:51am.

AnswerRe: Keeping correct layout when browser is resized Pin
Gerry Schmitz18-Jul-16 6:19
mveGerry Schmitz18-Jul-16 6:19 
QuestionStyling a Drag and Drop Items behavior in a WPF ListView Pin
Kenneth Haugland13-Jul-16 5:43
mvaKenneth Haugland13-Jul-16 5:43 
QuestionShort way defining a property with the NotifyPropertyChanged() call Pin
Mc_Topaz9-Jul-16 9:26
Mc_Topaz9-Jul-16 9:26 
AnswerRe: Short way defining a property with the NotifyPropertyChanged() call Pin
Mycroft Holmes9-Jul-16 11:35
professionalMycroft Holmes9-Jul-16 11:35 
AnswerRe: Short way defining a property with the NotifyPropertyChanged() call Pin
Mc_Topaz9-Jul-16 11:49
Mc_Topaz9-Jul-16 11:49 
AnswerRe: Short way defining a property with the NotifyPropertyChanged() call Pin
Super Lloyd10-Jul-16 14:31
Super Lloyd10-Jul-16 14:31 
AnswerRe: Short way defining a property with the NotifyPropertyChanged() call Pin
Pete O'Hanlon10-Jul-16 21:23
mvePete O'Hanlon10-Jul-16 21:23 
AnswerRe: Short way defining a property with the NotifyPropertyChanged() call Pin
Gerry Schmitz11-Jul-16 6:04
mveGerry Schmitz11-Jul-16 6:04 
AnswerRe: Short way defining a property with the NotifyPropertyChanged() call Pin
Kenneth Haugland13-Jul-16 4:12
mvaKenneth Haugland13-Jul-16 4:12 
GeneralRe: Short way defining a property with the NotifyPropertyChanged() call Pin
Mycroft Holmes13-Jul-16 12:54
professionalMycroft Holmes13-Jul-16 12:54 
QuestionAdd column sorting to a WPF grid Pin
Stephen Holdorf7-Jul-16 7:11
Stephen Holdorf7-Jul-16 7:11 
SuggestionRe: Add column sorting to a WPF grid Pin
Matt T Heffron7-Jul-16 7:39
professionalMatt T Heffron7-Jul-16 7:39 
GeneralRe: Add column sorting to a WPF grid Pin
Stephen Holdorf7-Jul-16 8:11
Stephen Holdorf7-Jul-16 8:11 
AnswerRe: Add column sorting to a WPF grid Pin
Gerry Schmitz8-Jul-16 6:52
mveGerry Schmitz8-Jul-16 6:52 
QuestionSingle Instance WPF App - Pass Params From Second Instance To First Instance Pin
Kevin Marois30-Jun-16 8:46
professionalKevin Marois30-Jun-16 8:46 
QuestionWPF empty tabbed dashboard example code Pin
Stephen Holdorf28-Jun-16 12:07
Stephen Holdorf28-Jun-16 12:07 
AnswerRe: WPF empty tabbed dashboard example code Pin
Pete O'Hanlon28-Jun-16 20:53
mvePete O'Hanlon28-Jun-16 20:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.