Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7157921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T12:58:24+00:00 2026-05-28T12:58:24+00:00

I am having following DataGrid Code <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> <UserControl.Resources> <!–Restrict

  • 0

I am having following DataGrid Code

<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">

    <UserControl.Resources>
<!--Restrict editing based on IsVariable-->
        <Style x:Key="CheckBoxCellStyle" TargetType="{x:Type CheckBox}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=IsVariable}" Value="true">
                    <Setter Property="IsEnabled" Value="false"/>
                </DataTrigger>
            </Style.Triggers>
            <Setter Property="HorizontalAlignment" Value="Center"/>
        </Style>
</UserControl.Resources>
<Grid>
        <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" >
            <WPFtoolkit:DataGrid.Columns>


<WPFtoolkit:DataGridCheckBoxColumn x:Name="dgChkRepeatingData" Binding="{Binding Path=MasterDataFlag}" MaxWidth="135" MinWidth="80"
                                     Header="Repeating data" Visibility="Collapsed" IsReadOnly="{Binding (IsVariable)}" 
                                     EditingElementStyle="{StaticResource CheckBoxCellStyle}"
                                      >
                </WPFtoolkit:DataGridCheckBoxColumn>

                <WPFtoolkit:DataGridCheckBoxColumn MaxWidth="100" Header="Max Element" x:Name="dgChkMaxElement"
                                                   Binding="{Binding Path=MaxElement}" MinWidth="70" Visibility="Collapsed" 
                                    EditingElementStyle="{StaticResource CheckBoxCellStyle}">
                </WPFtoolkit:DataGridCheckBoxColumn>

                <WPFtoolkit:DataGridCheckBoxColumn MaxWidth="100" Header="In For Loop" x:Name="dgChkInForLoop"
                                                   Binding="{Binding Path=InForLoop}" MinWidth="70" Visibility="Collapsed" 
                                    EditingElementStyle="{StaticResource CheckBoxCellStyle}">
                </WPFtoolkit:DataGridCheckBoxColumn>

                <WPFtoolkit:DataGridTextColumn x:Name="dgXPath" Binding="{Binding Path=XPath}" Header="XPath" Width="500"
                                               Visibility="Collapsed" IsReadOnly="{Binding Path=IsVariable}"
                                               EditingElementStyle="{StaticResource TextBoxCellStyle}"/>
</WPFtoolkit:DataGrid.Columns>
        </WPFtoolkit:DataGrid>

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 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T12:58:25+00:00Added an answer on May 28, 2026 at 12:58 pm

    You can use radiobuttons with a checkbox style to achieve mutually exclusive behavior. If you have any problem binding radiobuttons: radiobutton-binding

    <RadioButton IsChecked="{Binding VMProperty}" GroupName="IsSelectedGroup">
        <RadioButton.Style>
            <Style TargetType="{x:Type RadioButton}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="RadioButton">
                            <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=RadioButton}}" Content="{TemplateBinding Content}" />
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </RadioButton.Style>
    </RadioButton>
    

    But, i agree with Jaster. If you have each row binded to a ViewModel, the place to put this logic restriction is the ViewModel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have default.aspx page and one user control. usercontrol is having following code for
I am having following peice of code ,where in i am trying to serialize
Having the following class: public class SomeClass { private readonly int[] _someThings; public SomeClass()
Having the following classes, in two different assemblies: class Member { public string Label
Having the following class (.Net 3.5): public class Something { public string Text {get;
Having the following classes (highly simplified): public class Child { public string Label; public
Hi I am having following code working fine when placed without $(document).ready <asp:TextBox ID=TextBox_FirstName
I m having following Code in which this code executes when i click a
I am having following code which is taken from modern C++ design. While i
I am having following code. output of second %d in sprintf is always shown

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.