Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make mutually Exclusive checkBoxes in WPF DataGrid Columns
    primarykey
    data
    text
    <p>I am having following DataGrid Code</p> <pre><code>&lt;UserControl x:Class="abc.WPFApp.UCGrid" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:WPFtoolkit="http://schemas.microsoft.com/wpf/2008/toolkit" xmlns:local="clr-namespace:abc.WPFApp"&gt; &lt;UserControl.Resources&gt; &lt;!--Restrict editing based on IsVariable--&gt; &lt;Style x:Key="CheckBoxCellStyle" TargetType="{x:Type CheckBox}"&gt; &lt;Style.Triggers&gt; &lt;DataTrigger Binding="{Binding Path=IsVariable}" Value="true"&gt; &lt;Setter Property="IsEnabled" Value="false"/&gt; &lt;/DataTrigger&gt; &lt;/Style.Triggers&gt; &lt;Setter Property="HorizontalAlignment" Value="Center"/&gt; &lt;/Style&gt; &lt;/UserControl.Resources&gt; &lt;Grid&gt; &lt;WPFtoolkit:DataGrid x:Name="UCdataGridView" ItemsSource="{Binding}" CellStyle="{StaticResource defaultCellStyle}" RowStyle="{StaticResource defaultRowStyle}" ColumnHeaderStyle="{StaticResource defaultDataGridColumnHeader}" SelectionUnit="FullRow" IsSynchronizedWithCurrentItem="True" RowBackground="White" AlternatingRowBackground="AliceBlue" AutoGenerateColumns="False" SelectionMode="Extended" RowHeaderWidth="20" CanUserAddRows="True" CanUserDeleteRows="True" CanUserReorderColumns="False" CanUserResizeColumns="True" AllowDrop="True" KeyUp="UCGridKeyUp" &gt; &lt;WPFtoolkit:DataGrid.Columns&gt; &lt;WPFtoolkit:DataGridCheckBoxColumn x:Name="dgChkRepeatingData" Binding="{Binding Path=MasterDataFlag}" MaxWidth="135" MinWidth="80" Header="Repeating data" Visibility="Collapsed" IsReadOnly="{Binding (IsVariable)}" EditingElementStyle="{StaticResource CheckBoxCellStyle}" &gt; &lt;/WPFtoolkit:DataGridCheckBoxColumn&gt; &lt;WPFtoolkit:DataGridCheckBoxColumn MaxWidth="100" Header="Max Element" x:Name="dgChkMaxElement" Binding="{Binding Path=MaxElement}" MinWidth="70" Visibility="Collapsed" EditingElementStyle="{StaticResource CheckBoxCellStyle}"&gt; &lt;/WPFtoolkit:DataGridCheckBoxColumn&gt; &lt;WPFtoolkit:DataGridCheckBoxColumn MaxWidth="100" Header="In For Loop" x:Name="dgChkInForLoop" Binding="{Binding Path=InForLoop}" MinWidth="70" Visibility="Collapsed" EditingElementStyle="{StaticResource CheckBoxCellStyle}"&gt; &lt;/WPFtoolkit:DataGridCheckBoxColumn&gt; &lt;WPFtoolkit:DataGridTextColumn x:Name="dgXPath" Binding="{Binding Path=XPath}" Header="XPath" Width="500" Visibility="Collapsed" IsReadOnly="{Binding Path=IsVariable}" EditingElementStyle="{StaticResource TextBoxCellStyle}"/&gt; &lt;/WPFtoolkit:DataGrid.Columns&gt; &lt;/WPFtoolkit:DataGrid&gt; </code></pre> <p>This user control Grid comprised if three Columns which should be mutually exclusive. I want to achieve this by creating Triggers in XAML itself , How can we do this ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload