TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tony
NA
1
3.7k
DataGridComboBoxColumn in DataGrid
Feb 12 2012 12:59 PM
Hello. this is my problem.
I have a
DataGrid
, consisting of
2 columns
, one type
DataGridTextColumn
, the other
DataGridComboBoxColumn
.
All columns are loaded with the same value, "Item 0" "item 1", "item 3".
This is the situation: in the
first column I have the values
in the
second column
, DataGridComboBoxColumn, I don't see
ANYTHING
.
If I click in any cell of the second column, I get the ComboBox populated with the correct values: ("A1", "A2", "A3")
Where is the error and why the second column is empty?
Below I post the code to which I refer.
Many thanks
'Load data
Dim dt As New DataTable()
Dim dr As DataRow
dt.Columns.Add(New DataColumn("PopolaTEST", GetType(String)))
Dim i As Integer
For i = 0 To 3
dr = dt.NewRow()
dr(0) = "Item " + i.ToString()
dt.Rows.Add(dr)
Next i
Dim dv As New DataView(dt)
Test.ItemsSource = dv
Code in the del Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:col="clr-namespace:System.Collections;assembly=mscorlib"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="MainWindow" Height="350" Width="525">
<Grid>
<DataGrid x:Name="Test" Margin="5,5,5,77" AutoGenerateColumns="False" AlternatingRowBackground="#FFE5D429" AlternationCount="2">
<DataGrid.Columns>
<DataGridTextColumn Header="COL A" Binding="{Binding Path=PopolaTEST}"></DataGridTextColumn>
<DataGridComboBoxColumn Header="COL B" SelectedItemBinding="{Binding Path=PopolaTEST}">
<DataGridComboBoxColumn.ItemsSource>
<col:ArrayList>
<sys:String>A1</sys:String>
<sys:String>A2</sys:String>
<sys:String>A3</sys:String>
</col:ArrayList>
</DataGridComboBoxColumn.ItemsSource>
</DataGridComboBoxColumn>
</DataGrid.Columns>
</DataGrid>
<Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="18,251,0,0" Name="Button1" VerticalAlignment="Top" Width="75" />
</Grid>
Reply
Answers (
0
)
POP Dialog box
ListView not displaying observablecollection