예제 #1
0
        public OrderLinesView()
        {
            InitializeComponent();
            Persister = new ViewPersister(this);

            Loaded += (sender, args) => {
                ApplyStyles();
                Persister.Track(Expander, Expander.IsExpandedProperty);
                Persister.Track(OrdersGrid.RowDefinitions[Grid.GetRow(Expander)], RowDefinition.HeightProperty);
                Persister.Track(OrdersGrid.RowDefinitions[Grid.GetRow(Lines)], RowDefinition.HeightProperty);
                Persister.Restore();
            };

            Lines.CommandBindings.Add(new CommandBinding(DataGrid.DeleteCommand,
                                                         Commands.DoInvokeViewModel,
                                                         Commands.CanInvokeViewModel));

            DataGridHelper.CalculateColumnWidths(Lines);
            DataGridHelper.CalculateColumnWidths(SentLines);
            new Editable().Attach(Lines);

            new Editable().Attach(Offers);
            DataGridHelper.CalculateColumnWidths(Offers);
            ExpandedCollapsed(Expander, null);
        }
예제 #2
0
        public MinCosts()
        {
            InitializeComponent();

            Persister = new ViewPersister(this);
            Loaded   += (sender, args) => {
                ApplyStyles();
                Persister.Track(MainGrid.RowDefinitions[Grid.GetRow(Costs)], RowDefinition.HeightProperty);
                Persister.Track(MainGrid.RowDefinitions[Grid.GetRow(Offers)], RowDefinition.HeightProperty);
                Persister.Restore();
            };

            new Editable().Attach(Offers);
            DataGridHelper.CalculateColumnWidths(Offers);
            ApplyStyles();
            BindingOperations.SetBinding(OfferOverlayPanel, Grid.MaxHeightProperty,
                                         new Binding("ActualHeight")
            {
                Source    = Offers,
                Converter = new LambdaConverter <double>(v => v * 0.7)
            });
        }