Я хотел бы определить значение DesignWidth
с константой, но вид, по-видимому, не имеет определенной ширины в Blend. У меня есть Constants.class
Определить конструкциюWidth с константой в файле XAML
public static class Constants
{
public static int ApplicationWidth { get { return 1280;} }
public static int ApplicationHeight { get { return 720; } }
}
и View.xaml
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:constants="clr-namespace:app.Constants"
d:DesignWidth="{x:Static constants:Constants.ApplicationWidth}">
</UserControl>
В Visual Studio The View Ширина 267px
и в купаж 262px
. Как установить Width
без жесткого кодирования значений в файлах XAML
, чтобы иметь желаемый размер в Blend Visual Studio?
Возможно, класс 'Contants' должен быть статическим? Просто мысль. –
Я получаю тот же результат со статическим классом – Ionut