selecteditem

Android: Select items in a multi-select ListView inside AlertDialog

百般思念 提交于 2019-11-30 16:16:15
I am new to android development and struggling with how to select certain items in a listview hosted by an alertdialog. In the below code, lv.setItemChecked doesn't work as listview hasn't been generated yet, so I am wondering if there's any ListView or AlertDialog event which confirms that view has been generated. String [] values = {"a","b","c"}; ArrayAdapter<String> adp = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_multiple_choice, values); ListView lv = new ListView(this); lv.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); lv.setOnItemClickListener(this); lv.setAdapter

Android: Select items in a multi-select ListView inside AlertDialog

拈花ヽ惹草 提交于 2019-11-30 16:12:34
问题 I am new to android development and struggling with how to select certain items in a listview hosted by an alertdialog. In the below code, lv.setItemChecked doesn't work as listview hasn't been generated yet, so I am wondering if there's any ListView or AlertDialog event which confirms that view has been generated. String [] values = {"a","b","c"}; ArrayAdapter<String> adp = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_multiple_choice, values); ListView lv = new ListView

Displaying the selected item differently in ComboBox

让人想犯罪 __ 提交于 2019-11-30 14:23:38
问题 I have a combo box in which I set up an ItemTemplate that looks something like this: <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Piece.NoPiece}" Width="50" /> <TextBlock Text="{Binding Piece.Description}" Width="170" /> <TextBlock Text="{Binding Piece.Categorie.NomCategorie}" /> </StackPanel> </DataTemplate> </ComboBox.ItemTemplate> As you can see, I got three columns that let the user see different piece of information. However, I

WPF ComboBox SelectedItem

左心房为你撑大大i 提交于 2019-11-30 14:06:59
Ok been working with WPF for a while but I need some help. I have a ComboBox like below: <TabControl> <TabItem Header="1"> <ComboBox ItemsSource="{Binding MyList}" SelectedItem="{Binding MyListSelection}"/> </TabItem> <TabItem Header="2"/> </TabControl> Whenever I move away from tab 1 and then come back to it the selection gets removed. I think the reason for that is that the controls get destroyed when they go out of scope and then back in. But in the process of that the SelectedItem becomes null which isn't really what the user wanted, it's an event due to the UI lifecycle. So I'm wondering

IsSynchronizedWithCurrentItem attribute and current item updates

为君一笑 提交于 2019-11-30 12:46:05
I have a view model to manage a dialog type of view that allows filtering of a listing (if necessary) and selection of an item. The code works fine whether I set IsSynchronizedWithCurrentItem to true or not. My understanding is that this property is not true by default in a ListView, so I'd like to better understand this property. Here is the binding setup in the view's xaml (which works just as well without the synch property setting): <ListView ItemsSource="{Binding Projects.View}" IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding SelectedProject, Mode=TwoWay}" > The view model

Displaying the selected item differently in ComboBox

人盡茶涼 提交于 2019-11-30 10:50:56
I have a combo box in which I set up an ItemTemplate that looks something like this: <ComboBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Piece.NoPiece}" Width="50" /> <TextBlock Text="{Binding Piece.Description}" Width="170" /> <TextBlock Text="{Binding Piece.Categorie.NomCategorie}" /> </StackPanel> </DataTemplate> </ComboBox.ItemTemplate> As you can see, I got three columns that let the user see different piece of information. However, I would like the selected item in the combo to display only the second column. In other word, is there a

Find control inside Listbox.ItemTemplate (WPF C#)

丶灬走出姿态 提交于 2019-11-30 09:49:36
I have some problems finding the right TextBlock control inside a StackPanel . My markup: <ListBox Name="lstTimeline" ItemContainerStyle="{StaticResource TwItemStyle}" MouseDoubleClick="lstTimeline_MouseDoubleClick"> <ListBox.ItemTemplate> <DataTemplate> <DockPanel MaxWidth="{Binding ElementName=lstTimeline, Path=ActualWidth}"> <Border Margin="10" DockPanel.Dock="Left" BorderBrush="White" BorderThickness="1" Height="48" Width="48" HorizontalAlignment="Center"> <Image Source="{Binding ThumbNail, IsAsync=True}" Height="48" Width="48" /> </Border> <StackPanel Name="stkPanel" Margin="10" DockPanel

How can I get the clicked item in the ajax method?

烈酒焚心 提交于 2019-11-30 07:30:25
问题 Suppose the code of this page: <h:form prependId="false" id="form"> <h:selectManyCheckbox id="checkBoxList" value="#{backedBean.lstIdSelectedItems}" layout="pageDirection"> <f:selectItems value="#{backedBean.lstAvailableItems}" var="item" itemLabel="#{item.label}" itemValue="#{item.value}" /> <f:ajax listener="#{backedBean.itemClicked}" /> </h:selectManyCheckbox> </h:form> And the code of a session managed bean: public class BackedBean implements Serializable { private List<SelectItem>

WPF ComboBox SelectedItem - change to previous value

大憨熊 提交于 2019-11-30 06:12:00
I have a ComboBox that has the SelectedItem bound to the ViewModel. <ComboBox SelectedItem="{Binding SelItem, Mode=TwoWay}" ItemsSource="{Binding MyItems}"> When the user selects a new Item in the View ComboBox, I want to display a prompt and verify that they want to make the change. In the SetItem Property setter in the View Model, I display a Dialog to confirm the selection. When they say yes, it works fine. My problem is, when the user clicks on "No" I am not sure who to get the ComboBox to revert back to the previous value. The Property in the ViewModel has the correct older value, however

WPF binding to Listbox selectedItem

喜欢而已 提交于 2019-11-30 05:56:49
问题 Can anyone help with the following - been playing about with this but can't for the life of me get it to work. I've got a view model which contains the following properties; public ObservableCollection<Rule> Rules { get; set; } public Rule SelectedRule { get; set; } In my XAML I've got; <ListBox x:Name="lbRules" ItemsSource="{Binding Path=Rules}" SelectedItem="{Binding Path=SelectedRule, Mode=TwoWay}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text