Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
280
How to pass xamcomboeditor selecteditem as method parameter to ObjectDataProvider
posted

I have 2 xamcomboeditors in my Grid and selected item of first should pass as a string parameter to ObjectDataProvider of second. How to bind the selected item of first to method parameter of object data provider of second

<ObjectDataProvider x:Key="dbNames" MethodName="GetName" ObjectType="{x:Type myApp:NameList}" >
<ObjectDataProvider.MethodParameters>
<x:Static Member="sys:String.Empty" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

<ObjectDataProvider x:Key="dbSNames" MethodName="GetSName" ObjectType="{x:Type myApp:SNameList}" >
</ObjectDataProvider>

<ig:XamComboEditor x:Name="cmbBrowse" Height="20" Width="100" Padding="3,2" Margin="10 0 0 0"
IsEditable="True" AllowFiltering="True" AutoComplete="True" 
OpenDropDownOnTyping="False" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Row="1"
ItemsSource="{Binding Source={StaticResource dbSNames}}">
</ig:XamComboEditor>
<ig:XamComboEditor Name="cmbName" Height="20" Width="180" Padding="3,2"
AllowMultipleSelection="False" IsEditable="False" Grid.Row="2"
ItemsSource="{Binding Source={StaticResource dbNames}}" Margin="0 0 300 0">
</ig:XamComboEditor>

Code Behind:

public class NameList
{
public ObservableCollection<TypeList> GeName(string name)
{
if (!string.IsNullOrEmpty(servername))
{
ObservableCollection<string> lst = Program.GetCollectionFromDataset(Program.GetName(name));
if (lst == null)
return new ObservableCollection<TypeList>();
else
{
ObservableCollection<TypeList> cst = new ObservableCollection<TypeList>();
foreach (string s in lst)
{
cst.Add(new TypeList(s));
}
return cst;
}
}
else
return new ObservableCollection<TypeList>();
}
}

public class SNameList
{
public ObservableCollection<TypeList> GetSName()
{
ObservableCollection<string> lst = Program.GetCollectionFromDataset(Program.GetSName());
if (lst == null)
return new ObservableCollection<TypeList>();
else
{
ObservableCollection<TypeList> cst = new ObservableCollection<TypeList>();
foreach (string s in lst)
{
cst.Add(new TypeList(s));
}
return cst;
}
}
}
#endregion

public class TypeList
{
public string fieldOptions { get; set; }
public TypeList()
{
fieldOptions = null;
}
public TypeList(string a)
{
fieldOptions = a;
}
}