all
I just start c# wpf coding and it comes a problem I can not find a solution.
The grid will show one company in a row and the last column has a button
to do further process.
xaml looks like this:
<DataGridTemplateColumn Header="Operation">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Name="btnShowOrders" ToolTip="Show orders" Click="showOrders">
<materialDesign:PackIcon Kind="FileFind" Width="15" Height="15" />
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
In this case this button need to get company id in column 1 and use id to query orders belong to that company display in popup windows.
I want button rendered only if this company has order but can not make it happen.
There 2 problems:
- I code a property in viewmodel return false and button visibility bind to this property but button still always rendered
- I has a dictionary in viewmodel which has map of company id and order count. How can I use it to hide button if that company’s order count is zero
Thanks for helping newbie,