selecteditem

Angular PrimeNG dropdown component in reactive forms - initial value

£可爱£侵袭症+ 提交于 2019-12-06 15:44:43
using primeNg dropdown component, I'm trying to initialized the dropdown with initial value with no success, I'm using reactive approach. I checked the primeNg documentation and demos - almost all the examples there are using template driven, I would like to have the same with model driven. I'm able to render the dropdown with the values in the list but the selected item is not the one I declared in the form, instead it's the first item in the list. my code: template <div [formGroup]="formGroup"> <p-dropdown [options]="results" formControlName="second" (onChange)="onChangeHandler($event)"

Displaying Content only when ListViewItem is Selected

雨燕双飞 提交于 2019-12-06 11:57:35
问题 I have a ListBox when one of the ListBoxItems are selected I want to change the visibility of the button "View" and display it. Meaning that the default state is Hidden. Is this possible and if so, do I solve this with a trigger in XAML or in code behind? XAML Piece <ListBox Background="Transparent" ItemContainerStyle="{StaticResource listBoxTemplate}" BorderThickness="0"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Vertical" VerticalAlignment="Center" /> <

Animate selected item of wpf listbox

夙愿已清 提交于 2019-12-06 08:13:13
问题 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=

Problem with SelectedItem of WPF Editable ComboBox with DataTemplate

倾然丶 夕夏残阳落幕 提交于 2019-12-06 07:29:41
问题 I’m having the following issue with WPF ComboBox : XAML: <Window.Resources> <ResourceDictionary> <DataTemplate DataType="{x:Type this:Data}"> <ComboBox IsTextSearchEnabled="False" IsEditable="True" Text="{Binding Value}" ItemsSource="{Binding Menu}"/> </DataTemplate> </ResourceDictionary> </Window.Resources> <StackPanel> <ContentControl Content="{Binding}"/> <Button Click="ChangeData_Click">Change Data</Button> </StackPanel> Code behind: public Window1() { InitializeComponent(); DataContext =

How can I get the position of a row in a dataset in order to set the selected item in an Android Spinner?

坚强是说给别人听的谎言 提交于 2019-12-06 06:25:48
I have a Spinner that's populated using a cursor containing data from a database. It appears that it's impossible to set the selected item in the spinner using the value of the ID column of a row. And that the only way to set the selected item is by using the position of the row within the dataset. Is this correct? If so, is there a more efficient way of determining the row's position than by iterating through the dataset using the cursor? The inefficient (to my mind) way is outlined here . Thanks much! First step, create view for your data set, with joins etc.: CREATE VIEW my_view AS SELECT

Binding ComboBox.SelectedItem in Silverlight (more)

北战南征 提交于 2019-12-05 23:30:55
问题 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

How to set SelectedItem of a ComboBox when item is not part of the ItemsSource collection?

萝らか妹 提交于 2019-12-05 22:51:47
Following scenario: <ComboBox ItemsSource="{Binding Path=Names}" SelectedItem="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged}"> </ComboBox> Names is a string collection which might change through code in the ViewModel. For example Names could be set to either male names (John, Paul, George) or female names (Mary, Jane, Karen). Let's assume the male collection is active and the user selects "John" making it the SelectedItem. Now the collection changes to female names. By default the SelectedItem will be set to Null and John will not be displayed anymore. Instead an empty string will

How to ensure that no item is selected in databound ListBox?

北战南征 提交于 2019-12-05 16:24:59
OK, this must be a duplicate question, but I cannot find the answer: I have a listbox that is databound to a Collection. By default Items[0] is selected. How can I prevent this in order to ensure that the SelectionChanged event is raised any time I click a ListBoxItem? EDIT: I had already dismissed the SelectedIndex=-1 route, but I tried again: Setting the SelectedIndex to -1 in the Listbox's constructor (or as an attribute in XAML) does not work. It seems that the listbox is populated after the initialization and the selectedindex will become 0 after all.Same story for setting the

How to set a background drawable on a clicked GridView item in Android?

此生再无相见时 提交于 2019-12-05 15:07:00
I have a GridView with a bunch of icons and I need to select one. And by select I mean: I need the drawable id to store into a database (so I can access it later) I need to draw some kind of visual cue on the grid to let the user know which icon is currently selected I found this: http://groups.google.com/group/android-developers/browse_thread/thread/f08a58167dbaa8c8 So I guess setSelection is out of the picture and I can't use it to select the icon itself nor draw the visual cue. I know the grid item position in the onItemClickListener and I can save it as a private class variable. My biggest

FindByValue on ASP.NET DropDownList

浪子不回头ぞ 提交于 2019-12-05 14:40:46
I have the following code in a custom user control that contains a DropDownList named ddlAggerationUnitId. The DropDownList is DataBind'd on the Page_Load() event. The "value" is set to be 40 and it DOES exist. If I remove the logic for the set method the page will load and select the correct item, but if the value is bogus the page throws an exception. I'd like to avoid that exception by seeing if the value exists BEFORE trying to set it, hence why the logic is necessary. Right now it looks like the compiler is evaluating the if statement as false, even though I know for a fact it should be