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 8726817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:19:29+00:00 2026-06-13T08:19:29+00:00

So, on my DataGrid, I have the below Style, set up, Binding the ReadOnly

  • 0

So, on my DataGrid, I have the below Style, set up, Binding the ReadOnly and Reordering variables to be triggered using the MultiDataTrigger, I know it works because it greys out and sets values to read-only. The only problem is that if for the ComboBoxs created with the DataGridTemplateColumn don’t have their IsReadOnly value being set. How can I get this working? I don’t know how I would go about finding how the Template Column should be bound.

DataGrid Style (which is wrapped in the <DataGrid></DataGrid> tag)

 <DataGrid.Style>
            <Style TargetType="{x:Type DataGrid}">
                <Style.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding ReadOnly}" Value="True"/>
                            <Condition Binding="{Binding Reordering}" Value="False"/>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="IsReadOnly" Value="True" />
                            <Setter Property="Foreground" Value="Gray" />
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding ReadOnly}" Value="True"/>
                            <Condition Binding="{Binding Reordering}" Value="True"/>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="IsReadOnly" Value="True" />
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding ReadOnly}" Value="False"/>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="IsReadOnly" Value="False" />
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>
                </Style.Triggers>
            </Style>
        </DataGrid.Style>

Code for creating a a DataGridTemplateColumn

 DataTemplate comboDisplayTemplate = new DataTemplate();
 FrameworkElementFactory comboDisplayElement = new FrameworkElementFactory(typeof(ComboBox));
 Binding comboDisplayBinding = new Binding(f.ColumnName) { UpdateSourceTrigger = UpdateSourceTrigger.LostFocus };
 comboDisplayElement.SetBinding(ComboBox.SelectedValueProperty, comboDisplayBinding);
 comboDisplayElement.SetValue(ComboBox.DisplayMemberPathProperty, "Value");
 comboDisplayElement.SetValue(ComboBox.SelectedValuePathProperty, "Key");
 Binding comboDisplayListBinding = new Binding(f.ColumnName + "List");
 comboDisplayElement.SetValue(ComboBox.ItemsSourceProperty, comboDisplayListBinding);
 comboDisplayTemplate.VisualTree = comboDisplayElement;
 templateColumn.CellTemplate = comboDisplayTemplate;

  DataGridTemplateColumn templateColumn = new DataGridTemplateColumn() {
      Header = f.ShortDisplay,
 };

 DataTemplate comboboxTemplate = new DataTemplate();
 FrameworkElementFactory comboboxElement = new FrameworkElementFactory(typeof(ComboBox));
 Binding comboboxBinding = new Binding(f.ColumnName) { UpdateSourceTrigger = UpdateSourceTrigger.LostFocus };
 comboboxElement.SetBinding(ComboBox.SelectedValueProperty, comboboxBinding);
 comboboxElement.SetValue(ComboBox.DisplayMemberPathProperty, "Value");
 comboboxElement.SetValue(ComboBox.SelectedValuePathProperty, "Key");
 Binding comboboxListBinding = new Binding(f.ColumnName + "List");
 comboboxElement.SetValue(ComboBox.ItemsSourceProperty, comboboxListBinding);
 comboboxTemplate.VisualTree = comboboxElement;
 templateColumn.CellEditingTemplate = comboboxTemplate;
  • 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-06-13T08:19:30+00:00Added an answer on June 13, 2026 at 8:19 am

    The IsReadOnly property is used for Controls to allow/disallow users to change the underlying text of a Control, however ComboBoxes do not have an underlying text to change by default. I had to use the IsHitTestVisible property of UIElement, from MSDN -> Gets or sets a value that declares whether this element can possibly be returned as a hit test result from some portion of its rendered content.

      <Setter Property="IsHitTestVisible" Value="False" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the WPF DataGrid and have it set to place a red border
I have a datagrid view like this....in below image well thats works fine... I
I have a page (below) that has a datagrid that lists item's returned from
I'm using the Silverlight 3 datagrid and have a number of custom styles applied
I have a datagrid and I want to set the value of a dropdownlist
I have a DataGrid control binded to DataTable using the following: dataGrid1.ItemsSource = dataTable1.DefaultView;
I have a DataGrid that's being populated with the code below, the code below
I have this problem I'm using DataGrid + dojo.store.JsonRest as store. I want to
I am using Adobe Flash Builder 4 Premium. I have a mx:DataGrid and a
I have used datagrid on many projects populate the grid using the following Usual

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.