Hi
I need to get the value of the textbox so that I could change the item source accordingly. How could I do this?
Hello,
Do you have any other questions on this matter?
Sincerely,Valerie Developer Support Supervisor - XAMLInfragistics, Incwww.infragistics.com/support
Hi mheusser,
You should use that code inside the Loaded event. If you do it right after InitializeComponent, there is no guarantee that all the components inside the XamComboEditor will have been created. The reason you are getting null is probably because the TextBox hasn't been created yet. Handle the Loaded event on your UserControl and try it there.
I'm using the shared version. With your suggested code I get a null value.
My code:
<UserControl x:Class="PrestImmo.Infrastructure.CustomControls.LabelComboEditor" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ig="http://schemas.infragistics.com/xaml" x:Name="LCE">
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions>
<TextBlock x:Name="tbl" Text="{Binding ElementName=LCE, Path=LabelText}" Height="{Binding ElementName=LCE, Path=LabelHeight}" Width="{Binding ElementName=LCE, Path=LabelWidth}" VerticalAlignment="Center"/> <ig:XamComboEditor x:Name="xce" Grid.Column="1" Height="{Binding ElementName=LCE, Path=ComboBoxHeight}" Width="{Binding ElementName=LCE, Path=ComboBoxWidth}" HorizontalContentAlignment="{Binding ElementName=LCE, Path=HorizontalContentAlignment}" VerticalAlignment="Center" ItemTemplate="{Binding ElementName=LCE, Path=ItemTemplate}" ItemsSource="{Binding ElementName=LCE, Path=ItemsSource}" DisplayMemberPath="{Binding ElementName=LCE, Path=DisplayMemberPath}" SelectedValuePath="{Binding ElementName=LCE, Path=SelectedValuePath}" SelectedValue="{Binding ElementName=LCE, Path=SelectedValue, Mode=TwoWay}"/> </Grid></UserControl>
Constructor:
public LabelComboEditor(){ InitializeComponent(); var s = (SpecializedTextBox)Infragistics.Windows.Utilities.GetDescendantFromType(xce, typeof(SpecializedTextBox), false);}
Hello mheusser,
Which XamComboEditor are you using? The WPF only one or the shared one? The WPF only version has a Text property which you can use. http://help.infragistics.com/doc/WPF/2013.2/CLR4.0/?page=InfragisticsWPF4.Editors.v13.2~Infragistics.Windows.Editors.ValueEditor~Text.html
If you are using the shared version you are going to have to traverse the visual tree starting at the editor and go down till you find SpecializedTextBox. You can use the Infragistics.Windows.Utilities class to make this easier.
SpecializedTextBox tb = (SpecializedTextBox)Infragistics.Windows.Utilities.GetDescendantFromType(myComboEditor1, typeof(SpecializedTextBox), false);
http://help.infragistics.com/doc/WPF/2013.2/CLR4.0/?page=InfragisticsWPF4.v13.2~Infragistics.Windows.Utilities~GetDescendantFromType(DependencyObject,Type,Boolean).html
http://help.infragistics.com/doc/WPF/2013.2/CLR4.0/?page=InfragisticsWPF4.Controls.Editors.XamComboEditor.v13.2~Infragistics.Controls.Editors.Primitives.SpecializedTextBox.html
Let me know if you have any questions on this.