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
40
How to display the beginning part of the data in XamComboEditor after a user selects.
posted

The data on my comboboxeditor is so long but i want to be able to display the beginning part of it after the user selects.

Please help 

<ig:XamComboEditor x:Name="txtPreparerList" Grid.Column="3" Height="22" Margin="0,2,0,5" Width="180" Grid.Row="2" SelectedIndex="{Binding SelectedIndexForPreparerList,Mode=TwoWay}"
CheckBoxVisibility="Visible" ItemsSource="{Binding PreparerList, Mode=TwoWay}" DisplayMemberPath="FirstName" SelectionChanged="txtPreparerList_SelectionChanged"
AllowMultipleSelection="True" TabIndex="7" ></ig:XamComboEditor>

Parents
  • 6912
    Suggested Answer
    posted

    Hi,

    There is no out-of-the-box way to do that. However, you can do that by deriving from XamComboEditor and setting the position of the caret yourself:

    public class CustomXamComboEdiotor : XamComboEditor
    {
        private TextBox _textBoxPresenter;
    
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
    
            this._textBoxPresenter = this.GetTemplateChild("TextBoxPresenter") as TextBox;
        }
    
        protected override void OnSelectionChanged()
        {
            base.OnSelectionChanged();
    
            if (this._textBoxPresenter != null)
            {
                this.Dispatcher.BeginInvoke(new Action(() =>
                {
                    this._textBoxPresenter.SelectionStart = 0;
                    this._textBoxPresenter.SelectionLength = 0;
                }));
            }
        }
    }
    
    

     

    HTH

Reply Children