Hi
I trying to set GridViewComboBoxColumn itemsSource when GotFocus event is fired but it doesn't work.
I ' m using Q2 2010 SP1 libraries and I put
in the control constructor while the handler is
Thanks
Ivano
I trying to set GridViewComboBoxColumn itemsSource when GotFocus event is fired but it doesn't work.
I ' m using Q2 2010 SP1 libraries and I put
this
.AddHandler(RadComboBox.GotFocusEvent,
new
RoutedEventHandler(comboGotFocus));
in the control constructor while the handler is
void
comboGotFocus(
object
sender, RoutedEventArgs args)
{
GridViewCell cell = args.OriginalSource
as
GridViewCell;
if
(cell !=
null
&& cell.Column.UniqueName ==
"RegionId"
)
{
District district = cell.DataContext
as
District;
if
(district !=
null
&& cell.Content
is
LookupElement)
{
string
countryId = district.CountryId;
RadGridView gridView = (RadGridView)
this
.districtRegistryControl.ChildrenOfType<RadGridView>().First();
RadComboBox comboBox = (cell.Content
as
LookupElement).ComboBox;
if
(comboBox !=
null
)
{
comboBox.ItemsSource =
null
;
if
(
string
.IsNullOrEmpty(countryId) ==
false
)
comboBox.ItemsSource = from r
in
iGasContext.Context.Regions
where r.CountryId == countryId
select r;
else
comboBox.ItemsSource = iGasContext.Context.Regions;
}
}
}
}
Thanks
Ivano