예제 #1
0
        public CatalogNameView()
        {
            InitializeComponent();

            Promotions.SetBinding(MaxHeightProperty, new Binding("ActualHeight")
            {
                Mode      = BindingMode.OneWay,
                Source    = Catalogs,
                Converter = new LambdaConverter <double>(x => x / 2)
            });
            SizeChanged += (sender, args) => {
                CatalogNamesColumn.MaxWidth = args.NewSize.Width / 2;
            };

            Catalogs.KeyDown += (sender, args) => {
                if (args.Key == Key.Escape)
                {
                    DataGridHelper.Focus(CatalogNames);
                    args.Handled = true;
                }
            };

            ApplyStyles();
        }