Merge pull request #4 from Microsoft/qmatteoq
Fixed wrong behavior with the DataGrid
This commit is contained in:
Коммит
a9158cc9d1
|
@ -35,7 +35,13 @@
|
|||
<TextBlock x:Name="txtEmail" FontSize="16" Margin="5, 0, 0, 0" />
|
||||
</StackPanel>
|
||||
|
||||
<DataGrid x:Name="ExpensesGrid" SelectionChanged="OnSelectedExpense" AutoGenerateColumns="False" Grid.Row="4" Margin="0, 12, 0, 0">
|
||||
<DataGrid x:Name="ExpensesGrid"
|
||||
SelectionChanged="OnSelectedExpense"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
Grid.Row="4"
|
||||
Margin="0, 12, 0, 0"
|
||||
SelectionMode="Single">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="Date" Binding="{Binding Path=Date}" />
|
||||
<DataGridTextColumn Header="Type" Binding="{Binding Path=Type}" />
|
||||
|
|
|
@ -32,12 +32,15 @@ namespace ContosoExpenses
|
|||
|
||||
private void OnSelectedExpense(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var expense = e.AddedItems[0] as Expense;
|
||||
if (expense != null)
|
||||
if (e.AddedItems.Count > 0)
|
||||
{
|
||||
ExpenseDetail detail = new ExpenseDetail();
|
||||
detail.SelectedExpense = expense;
|
||||
detail.ShowDialog();
|
||||
var expense = e.AddedItems[0] as Expense;
|
||||
if (expense != null && expense.ExpenseId != 0)
|
||||
{
|
||||
ExpenseDetail detail = new ExpenseDetail();
|
||||
detail.SelectedExpense = expense;
|
||||
detail.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
</Menu>
|
||||
|
||||
<DataGrid x:Name="CustomersGrid" SelectionChanged="OnSelectedEmployee" Grid.Row="1" AutoGenerateColumns="False"
|
||||
SelectionMode="Single"
|
||||
IsReadOnly="True"
|
||||
Background="{StaticResource SemiTransparentBackground}"
|
||||
RowBackground="{StaticResource SemiTransparentBackground}"
|
||||
ColumnHeaderStyle="{StaticResource DataGridHeaderStyle}"
|
||||
|
|
|
@ -32,12 +32,15 @@ namespace ContosoExpenses
|
|||
|
||||
private void OnSelectedEmployee(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
var employee = e.AddedItems[0] as Employee;
|
||||
if (employee != null)
|
||||
if (e.AddedItems.Count > 0)
|
||||
{
|
||||
ExpensesList detail = new ExpensesList();
|
||||
detail.EmployeeId = employee.EmployeeId;
|
||||
detail.Show();
|
||||
var employee = e.AddedItems[0] as Employee;
|
||||
if (employee != null && employee.EmployeeId != 0)
|
||||
{
|
||||
ExpensesList detail = new ExpensesList();
|
||||
detail.EmployeeId = employee.EmployeeId;
|
||||
detail.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче