Sizing WPF controls based on Windows design guideline recommendationsHow do I handle/edit large amount of text in WPF?Find all controls in WPF Window by typeWPF tutorial for creating a custom usercontrolSizing problems when using custom WPF dialog controlHow to create a common WPF base window style?Designing a WPF control that has an expandable TextBlockWPF, How do I see what I'm doing in the editor after using Bindings?Make content automatically push down when a TextBox height automatically growsHosted Winform control does not respond to events from WPFTouchscreen control size

Disk usage buggy: 10G missing on Linux home partition on SSD

How do I present a future free of gender stereotypes without being jarring or overpowering the narrative?

Why did the Apple //e make a hideous noise if you inserted the disk upside down?

Active wildlife outside the window- Good or Bad for Cat psychology?

Cartoon about some kids who found dinosaur fossils and made them into pets

Customs and immigration on a USA-UK-Sweden flight itinerary

Fitting large table to single page

Chandra exiles a card, I play it, it gets exiled again

Why do some PCBs have exposed plated perimeters?

How can this fractal shape perfectly cover a certain platonic solid?

Find the closest three-digit hex colour

What is the meaning of "it" in "as luck would have it"?

Time for some proverbs!

Is it advisable to inform the CEO about his brother accessing his office?

How soon after takeoff can you recline your airplane seat?

Does "boire un jus" tend to mean "coffee" or "juice of fruit"?

Avoiding repetition when using the "snprintf idiom" to write text

Identifying positions of the last TRUEs in a sequence of TRUEs and FALSEs

A* pathfinding algorithm too slow

Why didn't Caesar move against Sextus Pompey immediately after Munda?

Word ending in "-ine" for rat-like

Why are examinees often not allowed to leave during the start and end of an exam?

Installed software from source, how to say yum not to install it from package?

Do electrons really perform instantaneous quantum leaps?



Sizing WPF controls based on Windows design guideline recommendations


How do I handle/edit large amount of text in WPF?Find all controls in WPF Window by typeWPF tutorial for creating a custom usercontrolSizing problems when using custom WPF dialog controlHow to create a common WPF base window style?Designing a WPF control that has an expandable TextBlockWPF, How do I see what I'm doing in the editor after using Bindings?Make content automatically push down when a TextBox height automatically growsHosted Winform control does not respond to events from WPFTouchscreen control size













1















How do I configure WPF to make its controls use the sizes recommended by Microsoft?



For example, a button should be 23 pixels high, including a 1 pixel transparent border. How do I implement the transparent border? Button.BorderBrush controls the visible border.



Another example is a single-line text box, which should be 23 pixels high.



Do I have to style everything by hand? Or is there way to cause the controls to default to a native Windows user experience?




Update: Here's a visual of some of the differences.



WPF controls:



WPF controls



Standard Windows controls: (from the Common Item Dialog, e.g. in Notepad, clicking File > Open)



Common Item Dialog controls



This isn't a perfect comparison, since the in the Common Item Dialog, the file name box is a ComboBox, not a TextBox. I tried comparing the Print Setup and Print dialogs (also from Notepad), but they don't use the same size buttons or even the same font as the open file dialog. I keep forgetting that I'm dealing with Microsoft here, not Apple.



There is a distinction regarding the button that is consistent through all of Notepad's dialogs, which WPF doesn't match by default. If the button is a default button, the border is thicker in Notepad. The button's transparent border turns blue. For a Notepad non-default button, you can click one pixel outside the visible border and still hit the button. This doesn't work for the WPF button.



Flexibility is nice, but native it-just-works-and-looks-great controls would be really nice. If there's a drop-in solution where I don't have to think about this stuff, that would be great.



Here's the XAML for the WPF controls:



<StackPanel Name="controls" Margin="20">
<TextBox Text="Default TextBox" />
<TextBox Height="23" Text="TextBox with height 23" />
<Button Content="Cancel" />
<Button Height="21" Content="Cancel" IsDefault="True" />
</StackPanel>


And the code-behind:



foreach (Control control in controls.Children) 
control.Margin = new Thickness(0, 10, 0, 10);
control.VerticalContentAlignment = VerticalAlignment.Center;










share|improve this question
























  • there is a default style, not sure if it's windows standard and you can configure each type's default style in one place. I tend to do it in App.xaml <Application.Resources />

    – kenny
    Mar 25 at 16:07












  • BorderBrush can be set to Transparent and BorderThickness to 1 pixel, but maybe I'm missing your point there.

    – kenny
    Mar 25 at 16:13






  • 1





    @kenny The Windows guidelines calls for two borders: a visible border (built into the control), surrounded by an invisible border. As far as I can deduce, the invisible border is intended to provide a larger click area, while keeping buttons a couple pixels smaller to leave more space between controls for a less cluttered feel. BorderBrush sets the visible border. There's no property that I know of to work with the invisible border.

    – Edward Brey
    Mar 25 at 16:17











  • Guess you're correct, they aren't windows standard. Maybe it's best to stick with Winforms. Someone already or even microsoft., perhaps built up a default set styles to make them so. The projects I've used WPF mostly tried look more stylish the what was the "old"standard windows "look".

    – kenny
    Mar 25 at 23:27











  • What's wrong with the default styles? They are as "standard" as it gets.

    – mm8
    Mar 26 at 10:25















1















How do I configure WPF to make its controls use the sizes recommended by Microsoft?



For example, a button should be 23 pixels high, including a 1 pixel transparent border. How do I implement the transparent border? Button.BorderBrush controls the visible border.



Another example is a single-line text box, which should be 23 pixels high.



Do I have to style everything by hand? Or is there way to cause the controls to default to a native Windows user experience?




Update: Here's a visual of some of the differences.



WPF controls:



WPF controls



Standard Windows controls: (from the Common Item Dialog, e.g. in Notepad, clicking File > Open)



Common Item Dialog controls



This isn't a perfect comparison, since the in the Common Item Dialog, the file name box is a ComboBox, not a TextBox. I tried comparing the Print Setup and Print dialogs (also from Notepad), but they don't use the same size buttons or even the same font as the open file dialog. I keep forgetting that I'm dealing with Microsoft here, not Apple.



There is a distinction regarding the button that is consistent through all of Notepad's dialogs, which WPF doesn't match by default. If the button is a default button, the border is thicker in Notepad. The button's transparent border turns blue. For a Notepad non-default button, you can click one pixel outside the visible border and still hit the button. This doesn't work for the WPF button.



Flexibility is nice, but native it-just-works-and-looks-great controls would be really nice. If there's a drop-in solution where I don't have to think about this stuff, that would be great.



Here's the XAML for the WPF controls:



<StackPanel Name="controls" Margin="20">
<TextBox Text="Default TextBox" />
<TextBox Height="23" Text="TextBox with height 23" />
<Button Content="Cancel" />
<Button Height="21" Content="Cancel" IsDefault="True" />
</StackPanel>


And the code-behind:



foreach (Control control in controls.Children) 
control.Margin = new Thickness(0, 10, 0, 10);
control.VerticalContentAlignment = VerticalAlignment.Center;










share|improve this question
























  • there is a default style, not sure if it's windows standard and you can configure each type's default style in one place. I tend to do it in App.xaml <Application.Resources />

    – kenny
    Mar 25 at 16:07












  • BorderBrush can be set to Transparent and BorderThickness to 1 pixel, but maybe I'm missing your point there.

    – kenny
    Mar 25 at 16:13






  • 1





    @kenny The Windows guidelines calls for two borders: a visible border (built into the control), surrounded by an invisible border. As far as I can deduce, the invisible border is intended to provide a larger click area, while keeping buttons a couple pixels smaller to leave more space between controls for a less cluttered feel. BorderBrush sets the visible border. There's no property that I know of to work with the invisible border.

    – Edward Brey
    Mar 25 at 16:17











  • Guess you're correct, they aren't windows standard. Maybe it's best to stick with Winforms. Someone already or even microsoft., perhaps built up a default set styles to make them so. The projects I've used WPF mostly tried look more stylish the what was the "old"standard windows "look".

    – kenny
    Mar 25 at 23:27











  • What's wrong with the default styles? They are as "standard" as it gets.

    – mm8
    Mar 26 at 10:25













1












1








1








How do I configure WPF to make its controls use the sizes recommended by Microsoft?



For example, a button should be 23 pixels high, including a 1 pixel transparent border. How do I implement the transparent border? Button.BorderBrush controls the visible border.



Another example is a single-line text box, which should be 23 pixels high.



Do I have to style everything by hand? Or is there way to cause the controls to default to a native Windows user experience?




Update: Here's a visual of some of the differences.



WPF controls:



WPF controls



Standard Windows controls: (from the Common Item Dialog, e.g. in Notepad, clicking File > Open)



Common Item Dialog controls



This isn't a perfect comparison, since the in the Common Item Dialog, the file name box is a ComboBox, not a TextBox. I tried comparing the Print Setup and Print dialogs (also from Notepad), but they don't use the same size buttons or even the same font as the open file dialog. I keep forgetting that I'm dealing with Microsoft here, not Apple.



There is a distinction regarding the button that is consistent through all of Notepad's dialogs, which WPF doesn't match by default. If the button is a default button, the border is thicker in Notepad. The button's transparent border turns blue. For a Notepad non-default button, you can click one pixel outside the visible border and still hit the button. This doesn't work for the WPF button.



Flexibility is nice, but native it-just-works-and-looks-great controls would be really nice. If there's a drop-in solution where I don't have to think about this stuff, that would be great.



Here's the XAML for the WPF controls:



<StackPanel Name="controls" Margin="20">
<TextBox Text="Default TextBox" />
<TextBox Height="23" Text="TextBox with height 23" />
<Button Content="Cancel" />
<Button Height="21" Content="Cancel" IsDefault="True" />
</StackPanel>


And the code-behind:



foreach (Control control in controls.Children) 
control.Margin = new Thickness(0, 10, 0, 10);
control.VerticalContentAlignment = VerticalAlignment.Center;










share|improve this question
















How do I configure WPF to make its controls use the sizes recommended by Microsoft?



For example, a button should be 23 pixels high, including a 1 pixel transparent border. How do I implement the transparent border? Button.BorderBrush controls the visible border.



Another example is a single-line text box, which should be 23 pixels high.



Do I have to style everything by hand? Or is there way to cause the controls to default to a native Windows user experience?




Update: Here's a visual of some of the differences.



WPF controls:



WPF controls



Standard Windows controls: (from the Common Item Dialog, e.g. in Notepad, clicking File > Open)



Common Item Dialog controls



This isn't a perfect comparison, since the in the Common Item Dialog, the file name box is a ComboBox, not a TextBox. I tried comparing the Print Setup and Print dialogs (also from Notepad), but they don't use the same size buttons or even the same font as the open file dialog. I keep forgetting that I'm dealing with Microsoft here, not Apple.



There is a distinction regarding the button that is consistent through all of Notepad's dialogs, which WPF doesn't match by default. If the button is a default button, the border is thicker in Notepad. The button's transparent border turns blue. For a Notepad non-default button, you can click one pixel outside the visible border and still hit the button. This doesn't work for the WPF button.



Flexibility is nice, but native it-just-works-and-looks-great controls would be really nice. If there's a drop-in solution where I don't have to think about this stuff, that would be great.



Here's the XAML for the WPF controls:



<StackPanel Name="controls" Margin="20">
<TextBox Text="Default TextBox" />
<TextBox Height="23" Text="TextBox with height 23" />
<Button Content="Cancel" />
<Button Height="21" Content="Cancel" IsDefault="True" />
</StackPanel>


And the code-behind:



foreach (Control control in controls.Children) 
control.Margin = new Thickness(0, 10, 0, 10);
control.VerticalContentAlignment = VerticalAlignment.Center;







wpf user-experience ui-guidelines






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 12:52







Edward Brey

















asked Mar 25 at 15:50









Edward BreyEdward Brey

27.4k11 gold badges136 silver badges199 bronze badges




27.4k11 gold badges136 silver badges199 bronze badges












  • there is a default style, not sure if it's windows standard and you can configure each type's default style in one place. I tend to do it in App.xaml <Application.Resources />

    – kenny
    Mar 25 at 16:07












  • BorderBrush can be set to Transparent and BorderThickness to 1 pixel, but maybe I'm missing your point there.

    – kenny
    Mar 25 at 16:13






  • 1





    @kenny The Windows guidelines calls for two borders: a visible border (built into the control), surrounded by an invisible border. As far as I can deduce, the invisible border is intended to provide a larger click area, while keeping buttons a couple pixels smaller to leave more space between controls for a less cluttered feel. BorderBrush sets the visible border. There's no property that I know of to work with the invisible border.

    – Edward Brey
    Mar 25 at 16:17











  • Guess you're correct, they aren't windows standard. Maybe it's best to stick with Winforms. Someone already or even microsoft., perhaps built up a default set styles to make them so. The projects I've used WPF mostly tried look more stylish the what was the "old"standard windows "look".

    – kenny
    Mar 25 at 23:27











  • What's wrong with the default styles? They are as "standard" as it gets.

    – mm8
    Mar 26 at 10:25

















  • there is a default style, not sure if it's windows standard and you can configure each type's default style in one place. I tend to do it in App.xaml <Application.Resources />

    – kenny
    Mar 25 at 16:07












  • BorderBrush can be set to Transparent and BorderThickness to 1 pixel, but maybe I'm missing your point there.

    – kenny
    Mar 25 at 16:13






  • 1





    @kenny The Windows guidelines calls for two borders: a visible border (built into the control), surrounded by an invisible border. As far as I can deduce, the invisible border is intended to provide a larger click area, while keeping buttons a couple pixels smaller to leave more space between controls for a less cluttered feel. BorderBrush sets the visible border. There's no property that I know of to work with the invisible border.

    – Edward Brey
    Mar 25 at 16:17











  • Guess you're correct, they aren't windows standard. Maybe it's best to stick with Winforms. Someone already or even microsoft., perhaps built up a default set styles to make them so. The projects I've used WPF mostly tried look more stylish the what was the "old"standard windows "look".

    – kenny
    Mar 25 at 23:27











  • What's wrong with the default styles? They are as "standard" as it gets.

    – mm8
    Mar 26 at 10:25
















there is a default style, not sure if it's windows standard and you can configure each type's default style in one place. I tend to do it in App.xaml <Application.Resources />

– kenny
Mar 25 at 16:07






there is a default style, not sure if it's windows standard and you can configure each type's default style in one place. I tend to do it in App.xaml <Application.Resources />

– kenny
Mar 25 at 16:07














BorderBrush can be set to Transparent and BorderThickness to 1 pixel, but maybe I'm missing your point there.

– kenny
Mar 25 at 16:13





BorderBrush can be set to Transparent and BorderThickness to 1 pixel, but maybe I'm missing your point there.

– kenny
Mar 25 at 16:13




1




1





@kenny The Windows guidelines calls for two borders: a visible border (built into the control), surrounded by an invisible border. As far as I can deduce, the invisible border is intended to provide a larger click area, while keeping buttons a couple pixels smaller to leave more space between controls for a less cluttered feel. BorderBrush sets the visible border. There's no property that I know of to work with the invisible border.

– Edward Brey
Mar 25 at 16:17





@kenny The Windows guidelines calls for two borders: a visible border (built into the control), surrounded by an invisible border. As far as I can deduce, the invisible border is intended to provide a larger click area, while keeping buttons a couple pixels smaller to leave more space between controls for a less cluttered feel. BorderBrush sets the visible border. There's no property that I know of to work with the invisible border.

– Edward Brey
Mar 25 at 16:17













Guess you're correct, they aren't windows standard. Maybe it's best to stick with Winforms. Someone already or even microsoft., perhaps built up a default set styles to make them so. The projects I've used WPF mostly tried look more stylish the what was the "old"standard windows "look".

– kenny
Mar 25 at 23:27





Guess you're correct, they aren't windows standard. Maybe it's best to stick with Winforms. Someone already or even microsoft., perhaps built up a default set styles to make them so. The projects I've used WPF mostly tried look more stylish the what was the "old"standard windows "look".

– kenny
Mar 25 at 23:27













What's wrong with the default styles? They are as "standard" as it gets.

– mm8
Mar 26 at 10:25





What's wrong with the default styles? They are as "standard" as it gets.

– mm8
Mar 26 at 10:25










0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55341653%2fsizing-wpf-controls-based-on-windows-design-guideline-recommendations%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55341653%2fsizing-wpf-controls-based-on-windows-design-guideline-recommendations%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해