c# - Get text of RadAutoCompleteBox -
how can text of radautocompletebox using radcontrols q1 2013 in c#?
autocompletebox.selecteditem
returns "servercraftertelerikwpf.command"
.
edit 1: here's xaml:
<telerik:radautocompletebox x:name="txtboxcommand" itemssource="{binding commands, source={staticresource viewmodel}}" displaymemberpath="acommand" autocompletemode="append" horizontalalignment="left" telerik:stylemanager.theme="modern" margin="280,405,0,0" verticalalignment="top" width="330" height="30" keydown="txtboxcommand_keydown"/>
and don't have c# code. want, when button pressed, text in radautocompletebox.
edit 2: , here's collection
:
public class command { public string acommand { get; set; } } /// <summary> /// view model mainwindow.xaml /// </summary> public class viewmodel { public observablecollection<command> commands { get; set; } public viewmodel() { commands = new observablecollection<command>() { new command() {acommand = "stop "}, // other commands... // ... // ... }; } }
you should take selecteditem
property. cast class , myclass.acommand
and suggest binding selecteditem
mode=twoway
in viewmodel can lot.
just add member viewmodel implementing command like:
private command _selecteditem; public command selecteditem { //get set inotifypropertychanged }
then xaml: bind radautocompletebox's selecteditem property like:
selecteditem="{binding selecteditem, mode=twoway}"
Comments
Post a Comment