Align items in a stack panel?

You can achieve this with a DockPanel: <DockPanel Width=”300″> <TextBlock>Left</TextBlock> <Button HorizontalAlignment=”Right”>Right</Button> </DockPanel> The difference is that a StackPanel will arrange child elements into single line (either vertical or horizontally) whereas a DockPanel defines an area where you can arrange child elements either horizontally or vertically, relative to each other (the Dock property changes the … Read more

How to bind to a PasswordBox in MVVM

Maybe I am missing something, but it seems like most of these solutions overcomplicate things and do away with secure practices. This method does not violate the MVVM pattern and maintains complete security. Yes, technically it is code behind, but it is nothing more than a “special case” binding. The ViewModel still has no knowledge … Read more

Difference between Visibility.Collapsed and Visibility.Hidden

The difference is that Visibility.Hidden hides the control, but reserves the space it occupies in the layout. So it renders whitespace instead of the control. Visibilty.Collapsed does not render the control and does not reserve the whitespace. The space the control would take is ‘collapsed’, hence the name. The exact text from the MSDN: Collapsed: … Read more