AutoCompleteBox t = new AutoCompleteBox();
TextBox textbox = new TextBox();
t = this as AutoCompleteBox;
if (string.IsNullOrEmpty(textbox.SelectedText))
{_cut.IsEnabled = false;
_copy.IsEnabled = false;
} I am Implementing RadcontextMenu for autocompletebox in base class for cut, copy paste functionalities....
In order to get the selected text inside the autocompletebox I just used
textbox = VisualTreeHelper.GetChild(VisualTreeHelper.GetChild(t, 0), 0) as TextBox;
while debugging I observed that it returns the null value for the textbox, and I got the exception (object reference not set to an instance of an object) in the nextline..
textbox.SelectedText gives that exception
if (string.IsNullOrEmpty(textbox.SelectedText))
{
_cut.IsEnabled = false;
_copy.IsEnabled = false;
}
please give solution for this..........