Skip to content

Instantly share code, notes, and snippets.

@SchreinerK
Last active September 15, 2020 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SchreinerK/88ae5f64c1e8ee3a3cddf2796f28de37 to your computer and use it in GitHub Desktop.
Save SchreinerK/88ae5f64c1e8ee3a3cddf2796f28de37 to your computer and use it in GitHub Desktop.
Line break in WrapPanel [WPF]
/// <summary>
/// Forces a new line in a <see cref="WrapPanel"/>
/// </summary>
public class WrapPanelLineBreak : FrameworkElement {
public WrapPanelLineBreak() {
Height = 0;
var binding = new Binding {
RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(WrapPanel), 1),
Path = new PropertyPath("ActualWidth")
};
BindingOperations.SetBinding(this, WidthProperty, binding);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment