selecteditem

set selected item in combobox - vb.net

我是研究僧i 提交于 2019-12-03 12:32:36
I am using this code to add a value to a combobox different then the one displayed: how to add value to combobox item Lets suppose i have 3 values in my Combobox: item 1 item 2 item 3 If i chose item 2 from the dropdown the code in the link works. But if i TYPE item 2 manually it doesnt work because i think that typing it only sets the combobox1.text value and not the combobox1.selecteditem . I can type a value present in the dropdown, or one not present. If i type one that is present, then the selectedItem property should also be set to the proper value. can this be done? Thanks sharkyenergy

ListBox Style Selected item on windows phone

雨燕双飞 提交于 2019-12-03 11:45:40
i would like know how can i add a style when a item of the listbox is selected. I have the following listbox: <ListBox x:Name="ListBoxDays" VerticalAlignment="Top" ItemTemplate="{StaticResource WeekDayTemplate}" ItemsSource="{Binding WeekDayList}" /> And i also have a DataTemplate to the listbox. <phone:PhoneApplicationPage.Resources> <DataTemplate x:Key="WeekDayTemplate"> <StackPanel x:Name="stackPanel" Orientation="Horizontal" Width="400" Margin="12,0,0,10" Height="100" > <StackPanel VerticalAlignment="Center" Orientation="Vertical"> <TextBlock Text="{Binding WeekDayName}" Style="

QML Listview selected item highlight on click

て烟熏妆下的殇ゞ 提交于 2019-12-03 08:22:13
问题 Hi I want to put this code : highlight: Rectangle { color: "black" radius: 5 opacity: 0.7 focus: true } into mouseArea in onclick handler: MouseArea { id: mouse_area1 z: 1 hoverEnabled: false anchors.fill: parent onClicked: { } This is all listView: ListView { id: listview1 x: 0 y: 82 // width: 574 // height: 967 width: window.width height: window.height visible: true keyNavigationWraps: false boundsBehavior: Flickable.DragAndOvershootBounds opacity: 1 maximumFlickVelocity: 2500 anchors

What is the simplest way to get the selected text in a combo box containing only text entries?

隐身守侯 提交于 2019-12-03 08:17:10
问题 My WPF ComboBox contains only text entries. The user will select one. What is the simplest way to get the text of the selected ComboBoxItem? Please answer in both C# and Visual Basic. Here is my ComboBox: <ComboBox Name="cboPickOne"> <ComboBoxItem>This</ComboBoxItem> <ComboBoxItem>should be</ComboBoxItem> <ComboBoxItem>easier!</ComboBoxItem> </ComboBox> By the way, I know the answer but it wasn't easy to find. I thought I'd post the question to help others. REVISION: I've learned a better

getItemAtPosition() How to get readable data from the selected item in a ListView

白昼怎懂夜的黑 提交于 2019-12-03 07:46:17
I have a listView of contacts that I got from the Android ContactManager sample. This list is showing up fine, but I can't figure out how to get info from the selected item, like "name" and "phone number". I can get the selected position, but the result of the mContactList.getItemAtPosition(position) is a ContentResolver$CursorWrapperInner and that doesn't really make any sense to me. I can't get heads or tails from that. Anyone know how I can get the name/id/phone number from the selected item in the listView? Here is my code. @Override public void onCreate(Bundle savedInstanceState) { Log.v

What is the easiest way to handle SelectedItem event with MVVM?

时光毁灭记忆、已成空白 提交于 2019-12-03 07:04:32
问题 In the code below, when user selects Customer in the combobox, the customer's name is displayed in a textbox. I fill the Combox box with an ObservableCollection property on my ViewModel but how do I handle the SelectedItem event in my ViewModel? It's easy to implement this with code-behind as shown below, but how do I do this with the MVVM pattern? I currently have DelegateCommand and AttachedBehaviors in my basic MVVM template that I can use, but I can't figure out how to get them to fire

What is the simplest way to get the selected text in a combo box containing only text entries?

烂漫一生 提交于 2019-12-02 23:35:56
My WPF ComboBox contains only text entries. The user will select one. What is the simplest way to get the text of the selected ComboBoxItem? Please answer in both C# and Visual Basic. Here is my ComboBox: <ComboBox Name="cboPickOne"> <ComboBoxItem>This</ComboBoxItem> <ComboBoxItem>should be</ComboBoxItem> <ComboBoxItem>easier!</ComboBoxItem> </ComboBox> By the way, I know the answer but it wasn't easy to find. I thought I'd post the question to help others. REVISION: I've learned a better answer. By adding SelectedValuePath="Content" as a ComboBox attribute I no longer need the ugly casting

QML Listview selected item highlight on click

为君一笑 提交于 2019-12-02 22:05:18
Hi I want to put this code : highlight: Rectangle { color: "black" radius: 5 opacity: 0.7 focus: true } into mouseArea in onclick handler: MouseArea { id: mouse_area1 z: 1 hoverEnabled: false anchors.fill: parent onClicked: { } This is all listView: ListView { id: listview1 x: 0 y: 82 // width: 574 // height: 967 width: window.width height: window.height visible: true keyNavigationWraps: false boundsBehavior: Flickable.DragAndOvershootBounds opacity: 1 maximumFlickVelocity: 2500 anchors.leftMargin: 0 highlightMoveSpeed: 489 contentWidth: 0 preferredHighlightEnd: 2 spacing: 5 highlightRangeMode

JavaFX TabPane: How to set the selected tab

人走茶凉 提交于 2019-12-02 20:01:15
I have a Java Desktop Application with JavaFX 2 in it and in my FX I've got a TabPane. I want to set the default tab. In other words I want to set a tab as selected. I found that there are multiple ways to find out which tab is selected and I found setSelectionModel() but I can't figure out how to use it. TabPane tabPane = new TabPane(); Tab tab0 = new Tab("blue"); tab.setContent(new Rectangle(200,200, Color.BLUE)); Tab tab1 = new Tab("green"); tab.setContent(new Rectangle(200,200, Color.GREEN)); tabPane.getTabs().addAll(tab0, tab1); The SelectionModel is the right approach. You can get the

What is the easiest way to handle SelectedItem event with MVVM?

别说谁变了你拦得住时间么 提交于 2019-12-02 19:37:51
In the code below, when user selects Customer in the combobox, the customer's name is displayed in a textbox. I fill the Combox box with an ObservableCollection property on my ViewModel but how do I handle the SelectedItem event in my ViewModel? It's easy to implement this with code-behind as shown below, but how do I do this with the MVVM pattern? I currently have DelegateCommand and AttachedBehaviors in my basic MVVM template that I can use, but I can't figure out how to get them to fire when "combobox selects a new item". View: <Window.Resources> <DataTemplate x:Key="CustomerTemplate">