I'm beginner in WPF. I want to set Visibility to Hidden on a Radiobutton when the databind value is equal to Null. I'm using WPF Toolkit. This is my code but it doesn't work :
<dg:DataGrid x:Name="dtGrdData" HorizontalScrollBarVisibility="Hidden" SelectionMode="Extended" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" CanUserSortColumns="False" AutoGenerateColumns="False"
RowHeaderWidth="0" RowHeight="50" >
<DataTrigger Binding="{Binding P_DAY_PRICE}" Value="{x:Null}">
<Setter Property="RadioButton.Visibility" Value="Hidden"></Setter>
</DataTrigger>
<dg:DataGrid.Columns>
<dg:DataGridTemplateColumn Header="1 day" Width="1.5*" >
<dg:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<RadioButton x:Name="rdBtnDayPrice" GroupName="grpNmPrice" Content="{Binding Path=P_DAY_PRICE}" Style="{StaticResource toggleStyle}" Checked="RadioButton_Checked"></RadioButton>
</DataTemplate>
</dg:DataGridTemplateColumn.CellTemplate>
</dg:DataGridTemplateColumn>
</dg:DataGrid.Columns>
</dg:DataGrid>
Can you help me ? Thanks
DataContext
not the data in theItemsSource
. You probably need to properly configure the DataContext of the grid. – Throve