selecteditem

How do I get the selected item from a Gridview with ImageAdapter? (Android)

a 夏天 提交于 2020-01-10 05:01:13
问题 I had used a ListView to show some data (String) retrieved from the database...quite simple, but one of my cooworkers decided to put an image in front of the text in the screen. We were not able to do it with Listview, but we found some example with GridView that looked exactly as we need then we spent some time using GridView and did put the image in the front of the text. Now, unfortunately we don't know how to get the selected item (based on the Text that comes from the item selected) I'm

WPF controls, disable changes to `SelectedItem` when bound property to `ItemsSource` changes

一笑奈何 提交于 2020-01-07 04:07:10
问题 When I use ComboBox or other controls that have ItemsSource and SelectedItem property bindings then each time upon the initial binding during runtime and also each time when the bound collection to ItemsSource changes I experience that the content of bound SelectedItem object is changed. How can I disable this? For example: I have <ComboBox MinWidth="300" ItemsSource="{Binding AvailableMasters}" SelectedItem="{Binding SelectedMaster}"> When I run the application the SelectedMaster property is

How do I bind selectedItem property of WPFToolkit-Datagrid to my viewmodel property?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 02:23:45
问题 I have a WPFToolkit-datagrid and a View-model class with a property - "SelectedGridItems" How do I bind selectedItem property of WPFToolkit-Datagrid to my viewmodel property ("SelectedGridItems") ? 回答1: Here is an attached property that hooks to the SelectionChanged event of the ListBox and populates a list of selected items to the ViewModel. You can simply change "ListBox" to "DataGrid". http://marlongrech.wordpress.com/2009/06/02/sync-multi-select-listbox-with-viewmodel/ Edit: Adding source

How do I bind selectedItem property of WPFToolkit-Datagrid to my viewmodel property?

╄→尐↘猪︶ㄣ 提交于 2020-01-06 02:23:27
问题 I have a WPFToolkit-datagrid and a View-model class with a property - "SelectedGridItems" How do I bind selectedItem property of WPFToolkit-Datagrid to my viewmodel property ("SelectedGridItems") ? 回答1: Here is an attached property that hooks to the SelectionChanged event of the ListBox and populates a list of selected items to the ViewModel. You can simply change "ListBox" to "DataGrid". http://marlongrech.wordpress.com/2009/06/02/sync-multi-select-listbox-with-viewmodel/ Edit: Adding source

Changing ListBox SelectedValuePath throws an exception

落花浮王杯 提交于 2020-01-05 07:54:43
问题 I wrote a quick application for an article on CodeProject (full article here. You can download the source code for this question directly from here). It's a very simple window that has a ListBox with simple objects (3 properties: 2 strings, 1 int). public class MyShape { public string ShapeType { get; set; } public string ShapeColor { get; set; } public int ShapeSides { get; set; } } I'm setting the SelectedValuePath in the code behind so a user can select a property from a combobox, and see

WPF selectedItem on Menu or get commandparameter in viewmodel

旧街凉风 提交于 2020-01-04 05:34:20
问题 I am searching for hours to fix a simple problem. I wanted to work with "SelectedItem" on my menuItems, but after hours of stackoverflow I saw that's impossible. I found a lot about "CommandParameter" but I don't understand how it works. This is what I want to do: I have a menu with "background1, background2,..." . If you select a background in the menu, I want to set that selected background as background. It's a schoolproject, so we have to use MVVM and no codebehind is allowed. How can I

set selected item in combobox - vb.net

拈花ヽ惹草 提交于 2020-01-01 04:43:08
问题 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

ListBox Style Selected item on windows phone

我与影子孤独终老i 提交于 2020-01-01 04:31:46
问题 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

How do you programmatically set focus to the SelectedItem in a WPF ListBox that already has focus?

≡放荡痞女 提交于 2019-12-28 03:46:05
问题 We want to set the SelectedItem of a ListBox programmatically and want that item to then have focus so the arrow keys work relative to that selected item. Seems simple enough. The problem however is if the ListBox already has keyboard focus when setting SelectedItem programmatically, while it does properly update the IsSelected property on the ListBoxItem , it doesn't set keyboard focus to it, and thus, the arrow keys move relative to the previously-focused item in the list and not the newly

Reset combobox selected item on set using MVVM

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-28 03:06:47
问题 I am using a ComboBox in my WPF application and following MVVM. There is a list of strings which I want to show in my ComboBox. XAML: <ComboBox ItemsSource="{Binding ItemsCollection}" SelectedItem="{Binding SelectedItem}" /> View Model: public Collection<string> ItemsCollection; // Suppose this has 10 values. private string _selectedItem; public string SelectedItem { get { return _selectedItem; } set { _selectedItem = value; Trigger Notify of property changed. } } Now this code is working