Click here to Skip to main content
15,887,477 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Need Some Help With This Design Pin
Kevin Marois22-Sep-15 6:32
professionalKevin Marois22-Sep-15 6:32 
QuestionStopping resizing of usercontrol and grid cell visibility Pin
Saurabh18cs22-Sep-15 0:43
Saurabh18cs22-Sep-15 0:43 
AnswerRe: Stopping resizing of usercontrol and grid cell visibility Pin
Gerry Schmitz23-Sep-15 8:21
mveGerry Schmitz23-Sep-15 8:21 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Saurabh18cs23-Sep-15 16:28
Saurabh18cs23-Sep-15 16:28 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Gerry Schmitz24-Sep-15 6:56
mveGerry Schmitz24-Sep-15 6:56 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Saurabh18cs24-Sep-15 21:47
Saurabh18cs24-Sep-15 21:47 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Gerry Schmitz24-Sep-15 22:54
mveGerry Schmitz24-Sep-15 22:54 
SuggestionRe: Stopping resizing of usercontrol and grid cell visibility Pin
J. Calhoun24-Sep-15 7:45
J. Calhoun24-Sep-15 7:45 
So if I am correct in understanding, you have a UserControl that is a button that you want to place in Grid.Row 2. Judging by the HorizontalAlignment="Left" and the Vertical Alignment="Center", this button is going to be placed in this grid along with some other control and you want them aligned and not to resize?

C#
<UserControl ...YourUserControl designHeight="50" designWidth="100">
    <Button x:Name="btnQCReport" Content="QC Report" Style="{StaticResource ButtonStyle}"/>
</UserControl>



1) Grid.Row="0" is the first row, Grid.Row="1" would be the second row, and since there are only 2 rows defined in the definition, I think the first step is to make it Grid.Row="1". Also, If there is nothing in Grid.Row="0" then the Auto deceleration would essentially be empty, and no space taken up.

2) VerticalAlignment="Center" and HorizontalAlignment="Left" are not going to be valid unless there are other controls inside this grid along with the usercontrol, otherwise the Auto will size the width and height to the control. Having said that, if there is indeed another control that is taller and wider than this control, inside the same grid space, then indeed this would need to be set. Also, if there is more than one control you will need some kind of arrangement control such as a StackPanel to place them. For example:

C#
<Grid Grid.Row="1">
    <StackPanel Orientation="Horizontal">
        <local:YourUserControl Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center"/>
        <local:AnotherUserControl Height="100" Width="200"/>
    </StackPanel>
</Grid>


Next I am guessing you have a property bound to the visibility that changes the visibility of your button; however, just to illustrate my point, if you were to set the visibility property to collapsed, the space should release. Such as:

C#
<Grid Grid.Row="1">
    <StackPanel Orientation="Horizontal">
        <local:YourUserControl Height="50" Width="100" HorizontalAlignment="Left"
                                    VerticalAlignment="Center" Visibility="Collapsed"/>
        <local:AnotherUserControl Height="100" Width="200"/>
    </StackPanel>
</Grid>


Hope this is what you were looking for! Again I am making a few assumptions, so if I am not answering what you are asking, if you could be more specific I would be happy to continue to try and assist you!
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Saurabh18cs24-Sep-15 21:50
Saurabh18cs24-Sep-15 21:50 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
J. Calhoun25-Sep-15 2:14
J. Calhoun25-Sep-15 2:14 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Saurabh18cs25-Sep-15 20:06
Saurabh18cs25-Sep-15 20:06 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
J. Calhoun28-Sep-15 3:06
J. Calhoun28-Sep-15 3:06 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Saurabh18cs29-Sep-15 0:13
Saurabh18cs29-Sep-15 0:13 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
J. Calhoun29-Sep-15 3:38
J. Calhoun29-Sep-15 3:38 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Saurabh18cs29-Sep-15 17:28
Saurabh18cs29-Sep-15 17:28 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
J. Calhoun30-Sep-15 3:11
J. Calhoun30-Sep-15 3:11 
GeneralRe: Stopping resizing of usercontrol and grid cell visibility Pin
Saurabh18cs30-Sep-15 22:45
Saurabh18cs30-Sep-15 22:45 
QuestionWPF UI Loading Question Pin
Kevin Marois11-Sep-15 5:50
professionalKevin Marois11-Sep-15 5:50 
AnswerRe: WPF UI Loading Question Pin
Kenneth Haugland12-Sep-15 1:57
mvaKenneth Haugland12-Sep-15 1:57 
AnswerRe: WPF UI Loading Question Pin
Pete O'Hanlon12-Sep-15 11:36
mvePete O'Hanlon12-Sep-15 11:36 
GeneralRe: WPF UI Loading Question Pin
Kevin Marois14-Sep-15 15:27
professionalKevin Marois14-Sep-15 15:27 
GeneralRe: WPF UI Loading Question Pin
Dave Kreskowiak15-Sep-15 3:25
mveDave Kreskowiak15-Sep-15 3:25 
QuestionVerticalAlignment.Bottom Problem Pin
Kevin Marois11-Sep-15 5:36
professionalKevin Marois11-Sep-15 5:36 
AnswerRe: VerticalAlignment.Bottom Problem Pin
Kenneth Haugland20-Sep-15 22:07
mvaKenneth Haugland20-Sep-15 22:07 
SuggestionRe: VerticalAlignment.Bottom Problem Pin
J. Calhoun24-Sep-15 9:22
J. Calhoun24-Sep-15 9:22 

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.