CareTaker22 CareTaker22 - 11 months ago 50
C# Question

Combining CheckBoxColumn and TextColumn into one column

Is it possible to combine a

into one column?

I have this class where I combine two columns values into one result:

public class ViewQuoteItemList
public string Supplier { get; set; }
public bool TrueFalse { get; set; }

public string CheckBoxColumn
get { return string.Format("{0} {1}", Supplier, TrueFalse); }

Then I bind one of the columns like this:

DataGridTextColumn columnFeedbackSupplier = new DataGridTextColumn();
columnFeedbackSupplier.Binding = new Binding("CheckBoxColumn");

I do not know how to bind/join a
with a
to display both the text and a checkbox in one column

Answer Source

DataGridTemplateColumn you can define Template for the same.

<DataGridTemplateColumn Header="ViewQuote">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Supplier}"/>
                <CheckBox IsChecked="{Binding TrueFalse}"/>