0
我想動態顯示/隱藏DataGridViewColumn
,因此我在演示模型中創建了名爲IsColumnVisible的bool
屬性,並將其應用於xaml中的Visibility=IsColumnVisible
。通過IsVisibility控制Telerki GridViewDataColumn的可見性
試過這也,
<conv:VisibilityToBoolConverter x:Key="VisibleIfTrue"
Inverted="True"
Not="False" />
<conv:VisibilityToBoolConverter x:Key="VisibleIfFalse"
Inverted="True"
Not="True" />
<telerik:GridViewDataColumn Width="100"
Header="Deadline Date"
DataFormatString="{}{0:MM/dd}"
DataMemberBinding="{Binding DEADLINE_DT}"
IsReadOnly="True"
TextAlignment="Center"
HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}"
ShowFieldFilters="False"
IsVisible="{Binding Path=IsDeadlineDateVisible, Converter={StaticResource VisibleIfTrue}}" />
,這是我的代碼背後的財產(演示模式)
public bool IsDeadlineDateVisible
{
get
{
return _IsDeadlineDateVisible;
}
set
{
_IsDeadlineDateVisible = value;
OnPropertyChanged("IsDeadlineDateVisible");
}
}
它不工作(列始終保持可見)。我錯過了什麼嗎?