Answer the question
In order to leave comments, you need to log in
Why doesn't Binding work?
There is a ViewModel that describes the fields and methods that return them.
Fragment:
public OrdersListViewModel()
{
base.DisplayName = "Список заказов";
Dat1 = DateTime.Now.AddDays(-7).Date;
Dat2 = DateTime.Now.AddDays(3).Date;
}
private ObservableCollection<ViewOrderHeader> _ViewOrdelHeaderCollection;
private DateTime _dat1;
public ObservableCollection<ViewOrderHeader> ViewOrdelHeaderCollection
{
...
}
public DateTime Dat1
{
get { return _dat1; }
set { _dat1 = value; base.OnPropertyChanged("Dat1"); }
}
}
<TextBlock Text="{Binding Path=Dat1}" /> <!--биндинг работает!!!-->
<DataGrid ItemsSource="{Binding}" >
<DataGrid.Columns>
<DataGridTextColumn>
<DataGridTextColumn.Header>
<Expander Header="Дата заказа">
<StackPanel Orientation="Vertical" DataContext="{Binding}">
<DatePicker x:Name="dpZ1A"
DisplayDate="{Binding Path=Dat1}" /> <!--Binding Не работает-->
</StackPanel>
</Expander>
</DataGridTextColumn.Header>
</DataGridTextColumn>
</DataGrid>
Answer the question
In order to leave comments, you need to log in
Top {Binding Path=Dat1}, bottom {Binding Path=Dt1}. Typo - missing character a.
When you run the program in the studio, diagnostic messages are often displayed in the Output window, and similar errors are displayed there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question