You must Sign In to post a response.
  • Category: WPF

    Reg : WPF Design grid sample

    Dear Team ,

    How to do the window design in WPF .Like Customer Page Details .
    when i am design the page not able give the margin and spacing at all .
    how to create the Resource file style in WPF .
  • #768593
    There are multiple ways to accomplish your task
    You could write your own GridWithMargin class, inherited from Grid, and override the ArrangeOverride method to apply the margins
    may be you can follow below code

    < Grid>
    < Grid.RowDefinitions>
    < RowDefinition />
    < RowDefinition />
    < /Grid.RowDefinitions>

    < custom:MyRowObject Style="YourStyleHereOrGeneralSetter" Grid.Row="0" />
    < custom:MyRowObject Style="YourStyleHere" Grid.Row="1" />
    < /Grid>

    RowDefinition and ColumnDefinition are of type ContentElement, and Margin is strictly a FrameworkElement property. So to your question, "is it easily possible" the answer is a most definite no. And no, I have not seen any layout panels that demonstrate this kind of functionality.

    You can add extra rows or columns as you suggested. But you can also set margins on a Grid element itself, or anything that would go inside a Grid, so that's your best workaround for now

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


Sign In to post your comments