Click here to Skip to main content
15,892,005 members
Home / Discussions / WPF
   

WPF

 
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 
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 
Thank you, this did help me to get a visual of what you are trying to accomplish. I still have one question and that is, the only buttons that you want to change the visibility on are the 8 buttons in the middle of your control correct? Under that assumption I have come up with a solution that I believe meets your requirements.

I made a User Control with the design height at 500 and the design width at 300 which allowed me to fit all your controls in the window and keep the same arrangement scheme that you provided.

Next, I created 3 rows and seperated your controls into the 3 Sections. The top controls will go in the first StackPanel like this:

HTML
<Grid>
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <StackPanel>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center" Grid.Row="0">
            <Label Content="Site No.:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
            <TextBox Width="150" Margin="5,5,0,5" HorizontalAlignment="Left" VerticalAlignment="Center"/>
            <Button Margin="1" Content="YourImage"/>
        </StackPanel>
        <Label Content="Commands" HorizontalAlinment="Left" VerticalAlignment="Center"/>
    </StackPanel>


The WrapPanel is where I host your 8 buttons, and the StackPanels will host your other controls.

HTML
<WrapPanel Orientation="Horizontal" Grid.Row="1">
        <Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
            <TextBlock TextWrapping="Wrap" TextAlignment="Center">
            New Site
            </TextBlock>
        </Button>
        <Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
            <TextBlock TextWrapping="Wrap" TextAlignment="Center">
                Modify Site
            </TextBlock>
        </Button>
        <Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
            <TextBlock TextWrapping="Wrap" TextAlignment="Center">
            Save To Draft
            </TextBlock>
        </Button>
        <Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
            <TextBlock TextWrapping="Wrap" TextAlignment="Center">
            Lowest Height Control
            </TextBlock>
        </Button>
        <Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
            <TextBlock TextWrapping="Wrap" TextAlignment="Center">
            QC Report
            </TextBlock>
        </Button>
        <Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
            <TextBlock TextWrapping="Wrap" TextAlignment="Center">
            Send for QC
            </TextBlock>
        </Button>
        <Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
            <TextBlock TextWrapping="Wrap" TextAlignment="Center">
            Maintain Scheme Checklist
            </TextBlock>
        </Button>
        <Button Height="50" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center">
            <TextBlock TextWrapping="Wrap" TextAlignment="Center">
            Configure Storey Heights
            </TextBlock>
        </Button>

This WrapPanel will cause your controls to take up the space that the collapsed button used to occupy and will move up rows if there is enough space on the row above it. The width of the WrapPanel will determine how many buttons per row as the buttons will fill in horizontally before moving down to the next row, this is possibly the reason for the vertical alignment you previously mentioned.
And Finally You can put your Last Section in another StackPanel:
HTML
    <StackPanel Grid.Row="2" HorizontalAlignment="Stretch">
        <Label Content"My Drafts:" HorizontalAlignment="Left" VerticalAlignment="Center"/>
        <Listbox Height="200" Width="250" Background="Azure" Margin="3"/>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
            <Button Content="Load" Width="75" Margin="0,0,10,0"/>
            <Button Content="Reassign" Width="75" Margin="0,0,10,0"/>
            <Button Content="Delete" Width="75" Margin="0,0,10,0"/>
        </StackPanel>
    </StackPanel>
</Grid>


I hope this meets your requirements! If you have any other questions I will be happy to help!
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 
QuestionWPF How To Freeze The UI Pin
Kevin Marois10-Sep-15 5:57
professionalKevin Marois10-Sep-15 5:57 
QuestionSearchTextBox by sean a. hanley Pin
Saurabh18cs9-Sep-15 16:22
Saurabh18cs9-Sep-15 16:22 
SuggestionRe: SearchTextBox by sean a. hanley Pin
Richard MacCutchan9-Sep-15 22:16
mveRichard MacCutchan9-Sep-15 22:16 
AnswerRe: SearchTextBox by sean a. hanley Pin
Pete O'Hanlon9-Sep-15 23:02
mvePete O'Hanlon9-Sep-15 23:02 
QuestionExtract audio from a video and process it Pin
Member 119602474-Sep-15 7:41
Member 119602474-Sep-15 7:41 
AnswerRe: Extract audio from a video and process it Pin
Richard MacCutchan4-Sep-15 21:37
mveRichard MacCutchan4-Sep-15 21:37 

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.