Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6105525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:58:53+00:00 2026-05-23T13:58:53+00:00

We are trying to follow these guidelines. For this I want to set application

  • 0

We are trying to follow these guidelines.
For this I want to set application level style or properties to set the margins between controls.

I am not able to set the margins through style as it ask me for target object and there might be the cases when I don’t want to follow the above.

I am able to set the margin by making some getter properties in App.xaml.cs

   /// <summary>
    /// Gets the margin to be set all around the dialog
    /// </summary>
    public Thickness MarginsAllAroundDialog
    {
      get
      {
        // returns default margin
        return new Thickness(7);
      }
    }

and setting the margin to the dialog as:

<Window x:Class="XXX.Views.MainWindow"
        x:Name="mainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:prism="http://www.codeplex.com/prism"
        Title="MainWindow" 
        Margin="{Binding Path=MarginsAllAroundDialog, Source={x:Static Application.Current}}"
        Height="350" 
        Width="525"
        WindowState="Maximized">

Is this the correct way or we achieve the same by simpler means.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T13:58:53+00:00Added an answer on May 23, 2026 at 1:58 pm

    I think your approach is good enough, but consider declaring margins in XAML.

    You can define margins as resources in your App.xaml:

    <Application>
        <Application.Resources>
            <Thickness x:Key="MarginsAllAroundDialog" Bottom="7" Left="7" Right="7" Top="7" />
        </Application.Resources>
    </Application>
    

    And reference these resources instead of using binding:

    <Window x:Class="XXX.Views.MainWindow"
            Margin="{StaticResource MarginsAllAroundDialog}">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to follow these docs: http://readthedocs.org/docs/neo4j-rest-client/en/latest/indices.html This works fine from neo4jrestclient.client import GraphDatabase,
I want to include Core Location and I'm trying to follow this tutorial: http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/
I am trying to follow these guidelines to make my page load quicker. I
I am trying to follow these instructions: http://source.android.com/source/downloading.html I have set up a fresh
I'm trying to follow these instructions to set up a java development environment under
I have been trying to follow the guidelines in this Microsoft article to authenticate
Trying to follow this example. (Section String sorting...) Is there anything obvious that would
I am trying to follow this article to do the same for adding a
I've just installed GeoDjango (yay) and now I'm trying to follow these instructions to
I've installed PostgreSQL and PostGIS, and now I'm trying to follow these instructions: http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#spatialdb-template

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.