combobox

CollectionContainer doesn't bind my Collection

女生的网名这么多〃 提交于 2020-01-06 21:12:08
问题 I have something like a form where the user can assign a cutomer to a vehicle. But this is optional. The customers are in a combobox. I need a way to make sure that the user can choose 'none' if the combobox is open. if have found something like this: <ComboBox.ItemsSource> <CompositeCollection> <ComboBoxItem IsEnabled="False" Foreground="Black">none</ComboBoxItem> <CollectionContainer Collection="{Binding Source={StaticResource DataKey}}" /> </CompositeCollection> </ComboBox.ItemsSource> But

How to Bind ComboBox inside a Datagrid?

落爺英雄遲暮 提交于 2020-01-06 20:34:50
问题 I have a table called groups as shown below : After looking at the image above I think you might have understood that primary key and foreign key exist in the same table. I think this is what developers call cyclic reference. In MainWindow.xaml I have a DataGrid which contains three columns namely Group Name, Parent Name, Description. The xaml looks like : <Window .......> <Window.DataContext> <self:MainWindowViewModel /> </Window.DataContext> <DataGrid ItemsSource="{Binding Groups}" TabIndex

C# DatagridView search/filter

白昼怎懂夜的黑 提交于 2020-01-06 20:01:47
问题 I am new to c#, I am trying to use filter the datagridview based on combobox value. Initially I loaded datagridview with all the desired values from database, now I want whenever user selects anything from combobox, the values in DataGridView should also change. One Solution which works for me is to request the database on each combobox value change and it works... code is attached for that DataRowView view = (DataRowView)comboBox2.SelectedItem; int year = (int) view.Row["Year"]; DataTable dt

C# combobox value to pass to SQL parameter

僤鯓⒐⒋嵵緔 提交于 2020-01-06 19:55:30
问题 This question is related to my previous one here: Populating C# combobox from SQL and restrict results based on choice hoping to get more attention. Given a combobox from which I'd like to pass the value. On the SelectedIndexChange property I put a method, which calls a Stored Procedure from SQL. SqlCommand command; command.Parameters.Add("@someparameter", combobox1.GetItemText(combobox1.SelectedItem)); command.CommandText = "StoredProcedure1"; command.ExecuteNonQuery(); Well, it takes no

and operator in Linq and select distinct values using linq

雨燕双飞 提交于 2020-01-06 19:37:14
问题 I am new to .net. I have a form in which there are two comboboxes cbProduct and cbBrandName and also a label lblPrice . I am trying to implement the below code but it is showing blue scribbles to && . (Error: operator '&&' cannot be applied to operands of type 'lambda expression' and 'lambda expression' ) I tried the below code: ( not working ) lblPrice.Text = string.Empty; lblPrice.Text = doc.Descendants("items" ).Where((x => x.Element("productname" ).Value.Equals(cbProduct.SelectedItem

how to add a combo box in a datagrid view for only one cell dynamically

↘锁芯ラ 提交于 2020-01-06 19:26:34
问题 I am reading an xml file using dataset and then i am creating a datagridview and assigning the table from dataset to datagridview.datasource dynamically. The problem i am facing here is, i want to add a combobox for one cell in datagridview. Below is my code : datagridview1.AllowUserToAddRows = false; datagridview1.AllowUserToDeleteRows = false; datagridview1.RowHeadersVisible = false; datagridview1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; datagridview1.AutoSizeRowsMode

org.springframework.beans.NotReadablePropertyException: Invalid property 'idValue' of bean class [java.lang.String]:

我的梦境 提交于 2020-01-06 17:55:55
问题 I have a dropdown, the value of which I am generating in my controller and passing that value to my jsp page. I am getting the following exception in the "itemValue" attribute of my "form:options" tag. Why do I need a getter setter for the itemValue because however I am having value for my "typeCode". But to avoid any confusion, I added getter setter for idValue also, but still getting the same error. Kindly help. JSP: <% Map LCCLSTypeCode = (Map) request.getAttribute("LCCLSTypeCode"); System

Binding Combobox Name using Id value

这一生的挚爱 提交于 2020-01-06 14:48:13
问题 I have a combobox control. I am getting combobox values from Database. There I have Id and Name. But I am binding only Name in the combobox. what i want is, 1. If I select any name in the Combobox, I need to save the Corresponding Id in my Database. Now I am able to bind the value from database and Display the Name in Combobox. but when I select any value in combobox and try to save means, it shows null value on the ID. Here is my code. Please help me to find some solution. Xaml: <ComboBox x

ComboBoxes sharing Observable Collection keeps breaking

好久不见. 提交于 2020-01-06 13:51:59
问题 I have four comboboxes that are experiencing a weird quirk. Its hard for me to explain exactly whats going on... so I put it in a video: https://www.youtube.com/watch?v=OuB-kSGMMSo <ComboBox x:Name="images1" Grid.Row="0" Grid.Column="0" Margin="3"/> <ComboBox x:Name="images2" Grid.Row="0" Grid.Column="1" Margin="3"/> <ComboBox x:Name="images3" Grid.Row="0" Grid.Column="2" Margin="3"/> <ComboBox x:Name="images4" Grid.Row="0" Grid.Column="3" Margin="3"/> Code behind public ObservableCollection

Caliburn.micro, WPF and two comboboxes

半城伤御伤魂 提交于 2020-01-06 12:44:04
问题 I want to solve Master -> Detail problem with my Caliburn.Micro + wpf project. I have two comboboxes coded like this in TaskManagerView.xaml : <ComboBox x:Name="ProjectsList" SelectedValuePath="{Binding Path=SelectedProjectsList, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /> <ComboBox x:Name="TasksList"/> The first Combobox ProjectsList works ok, i can get what i want to. Second is a little complicated. I get SelectedProjectList correctly (while im debuging on button i see what i