Putting that in code doesn't make it smaller.
Those things should be in the XAML file, not in the .cs