selecteditem

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

回眸只為那壹抹淺笑 提交于 2019-12-04 12:18:13
问题 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

Animate selected item of wpf listbox

荒凉一梦 提交于 2019-12-04 11:47:33
I'm trying to set a global style for all the listboxes in my application. Below is the xaml code that i've used. Here i've tried to trigger out an animation but it doesn't work. I just want an animation on the selected item. Any help? <Style TargetType="{x:Type ListView}"> <Style.Setters> <Setter Property="BorderThickness" Value="5" /> <Setter Property="FontSize" Value="16" /> <Setter Property="FontFamily" Value="Arial" /> <Setter Property="ItemTemplate"> <Setter.Value> <DataTemplate x:Name="ListViewItemTemplate"> <TextBlock Text="{Binding}" Padding="0,0,5,5"/> </DataTemplate> </Setter.Value>

Prevent WPF ListBox from selecting item under mouse when layout changes

浪尽此生 提交于 2019-12-04 11:14:43
If a WPF ListBox gets a MouseMove event while the mouse button is held down, it will change the listbox's selection. That is, if you click the mouse on item #1, and then drag over item #2, it will deselect item #1 and select item #2 instead. How can I prevent this? That's the short version. The slightly longer version is this: When the user double-clicks an item in my ListBox, I make other changes to my layout, which includes showing other controls above the ListBox. This moves the ListBox downwards, which means the mouse is now positioned over a different ListBoxItem than it was when the user

WPF ComboBox SelectedItem not Updating

£可爱£侵袭症+ 提交于 2019-12-04 05:19:20
问题 I am facing a problem while working with a WPF ComboBox. My situation is that I have a ComboBox that is displaying some values. I am adding ContentControl s to ComboBox' Items property. I have bound the Content of these ContentControl to some datasource so that I can change the Content dynamically. The problem is if the Content of item which is selected changes the item in ComboBox drop down updates but item in ComboBox SelectionChange remains same. Any suggestions please? 回答1: Instead of

SelectedItem on ComboBox

末鹿安然 提交于 2019-12-04 05:13:50
问题 There is a ComboBox in the application which is bound to a collection of items. There are cases that user can select an item from the ComboBox but the selected item might not be ready yet so the ComboBox selected item must get back to the previous selected item (or some other item in the collection), but in the current application ComboBox always shows the selected item from the user instead of retrieving the valid item after setting it back and calling notify property change. The flowing is

Synchronizing a SelectedPath property with the SelectedItem in WPF's TreeView

倾然丶 夕夏残阳落幕 提交于 2019-12-04 04:10:45
问题 I am trying to create a SelectedPath property (e.g. in my view-model) that is synchronized with a WPF TreeView . The theory is as follows: Whenever the selected item in the tree view is changed ( SelectedItem property/ SelectedItemChanged event), update the SelectedPath property to store a string that represents the whole path to the selected tree node. Whenever the SelectedPath property is changed, find the tree node indicated by the path string, expand the whole path to that tree node, and

Binding ComboBox.SelectedItem in Silverlight (more)

做~自己de王妃 提交于 2019-12-04 03:22:19
Related to my previous question: Binding ComboBox.SelectedItem in Silverlight I have a ComboBox bound like so: <ComboBox x:Name="PART_CommentaryList" HorizontalAlignment="Left" Margin="3" ItemsSource="{Binding Path=CurrentVideo.Commentaries}" SelectedItem="{Binding Path=CurrentCommentary, Mode=TwoWay}"> Both the CurrentVideo and CurrentCommentary property change regularly. After a few times, I get this error: Category: ManagedRuntimeError Message: System.ArgumentException: Value does not fall within the expected range. at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData

Programmatically set ComboBox SelectedItem in WPF (3.5sp1)

瘦欲@ 提交于 2019-12-04 02:53:00
I have been confused while setting SelectedItem programmaticaly in wpf applications with Net Framework 3.5 sp1 installed. I have carefully read about hundred posts \topics but still confused(( My xaml: <ComboBox name="cbTheme"> <ComboBoxItem>Sunrise theme</ComboBoxItem> <ComboBoxItem>Sunset theme</ComboBoxItem> </ComboBox> If I add IsSelected="True" property in one of the items - it's dosn't sets this item selected. WHY ? And i was try different in code and still can't set selected item: cbTheme.SelectedItem=cbTheme.Items.GetItemAt(1); //dosn't work cbTheme.Text = "Sunrise theme"; //dosn't

Type list of selected items in a wpf datagrid

陌路散爱 提交于 2019-12-03 13:48:38
I send the selected items to a specific command when the selection changes (each item is a class X) I get them as object how can I convert it to a list? I tried: 1. IList<x> SelectedItemsList = obj as ObservableCollection<x>; 2. IList<x> SelectedItemsList = obj as IList<x>; 3. List<x> SelectedItemsList = obj as List<x>; It did not help. This type of list: System.Windows.Controls.SelectedItemCollection I want to convert it to my list: ObservableCollection<x>/IList<x>/List<x> (the ViewModel not recognized a list of controls of wpf) The type of the SelectedItems property is the non-generic IList

AngularJS - setting selected value of dropdown does not work

时光怂恿深爱的人放手 提交于 2019-12-03 13:06:18
I made a fiddle replicating my problem here: http://jsfiddle.net/U3pVM/2840/ As the title suggests, I can't set the selected value of a select populated using ng-options. I have searched and tried all possible solutions that I found. Any help or suggestions would be appreciated! HTML <div ng-app> <h2>Todo</h2> <div ng-controller="TodoCtrl"> <select ng-model="ddlRooms" ng-options="r.id as r.Name for r in Rooms"> </select> {{$scope.test}} </div> </div> Angular function TodoCtrl($scope) { $scope.Rooms = [{ Name: 'Toddler', id: 1 },{ Name: 'other', id: 2 }]; $scope.options = [{ Name: 'other', id: