CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    [RESOLVED] managing Text Block!

    Hi! This is my first WPF application. Here I have 25 Text Blocks side by side and the window is set at maximized state. And Here is the Problem when My system screen resolution at 800 X 600 it runs fine because window size is of 800 X 600.....but when my system screen resolution is set more than that only middle text text block stretches and if I improve the anchoring all the text boxes gets together in one side of the screen leaving the other half empty which does not look nice.
    I have tried the same thing on the Windows Form but failed after long try which is the same reason why I shifted to WPF. I have similar threads over the C# window form forum so the guys who have spend their time helping me, please dont get pissed off...I have tried my best solving this problem.....
    Everything ashide Help on this part would be really Helpful...
    Last edited by rocky_upadhaya; February 11th, 2010 at 06:24 AM.

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: managing Text Block!

    What behavior do you expect?

    When resizing the app, do you expect the width of each textbox to grow and shrink equally?

  3. #3
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    Re: managing Text Block!

    Can we grow the size of Text Blocks without operlaping each other?? and without hiding any of the blocks......
    Last edited by rocky_upadhaya; February 8th, 2010 at 11:42 AM.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: managing Text Block!

    Let me ask the question again....

    Do you expect the width of each textbox to grow and shrink equally?

  5. #5
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    Re: managing Text Block!

    yes....

  6. #6
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: managing Text Block!

    Here you go.

    To simplify the code, I used a TextBlock style to get rid of the redundant properties.

    To get each textblock to resize proportially, I added some columns to the grid.

    Fyi. When you attach a project, please remove the unnecessary files (*.suo) and folders (bin and obj).

    See the updated .zip attachment.
    Attached Files Attached Files

  7. #7
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: managing Text Block!

    Btw, the previous code is a quick and dirty approach. You would probably want to use a different control (like a listbox) and bind to a collection. That way, you aren't tied to exactly 24 items (unless of course, 24 items is what you need).

  8. #8
    Join Date
    Dec 2009
    Location
    Kathmandu,Nepal
    Posts
    168

    Re: managing Text Block!

    Thanks...I will Try using List box too...and thanks a lot for the help.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured