selecteditem

Setting WPf Datagrid Combobox value to its respective textbox

I am having a textbox and a combobox as a template column. Below is XAML <wpfkit:DataGrid Margin="3" Style="{DynamicResource SimpleDataGrid}" FontWeight="Normal" MaxHeight="100" CanUserAddRows="True" ItemsSource="{Binding Source={StaticResource odpExistingGHSCodesColl}}" AutoGenerateColumns="False" Name="dgGHS" VerticalScrollBarVi...

WPF binding to Listbox selectedItem

Hi, 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="{B...

Mutually Exclusive SelectedItem

I have a treeview and a datagrid. When I select an item on my datagrid, I want to set the selectedItem on my treeview to null, and when I select an item on my treeview I want to set the selectedItem on my datagrid to null. I'd also like to have a central FocussedItem notification property that both the treeview and datagrid update with...

How to fix selected Item in a collection control on a user control (using the MVVM implementation) in WPF

Hi, I hope someone can help me... Josh Smith did a great article on "WPF apps with the Model-View View-Model", and included in his article was the following code sample. If you download the code sample and run the app and view all customers, then select a company (e.g. 4th company), then click "Create new customer" (which will open a t...

ComboBox SelectedItem does not change after clearing the observable collection.

Hi, I'm having an issue witha combobox whixh is bounded to an observable collection and I was wondering if anyone can point to what am i missing. I have a combobox which is bounded to a simple ObservableCollection also I bind the selectedIndex in a OneWay binding to some property. In my application i get to a point where i want to clea...

Telerik Radgrid WPF

Hi, My WPF page has a RadGrid control provided by Telerik. The Grid is a nested grid which essentially means that clicking on the (+) sign on the leftmost column of the row expands the row into a Subgrid. This is being done by specifying a hierarchical grid in my XAML. Everything works just fine when you click on the row and expand the ...

Programmatically set ComboBox SelectedItem in WPF (3.5sp1)

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> ...

Animate selected item of wpf listbox

Hi all, 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="BorderThic...

[WPF] SelectionChanged of a child ListBox

Hi, I have a ListBox bound to an ObservableCollection with an ItemTemplate that contains another ListBox. First of all, I tried to get the last selected item of all the listboxes (either the parent and the inner ones) from my MainWindowViewModel this way: public object SelectedItem { get { return this.selectedItem; } set {...

how to check whether the item in the combo box is selected or not in c#?

im having a combo box in which i have to display dates from database...user have to select a date from the combo box to proceed further...but im not able to make the user aware of selecting the item from the combo box first to proceed further...what is the process so that a user can get a message if he has not selected the date from the ...

WPF Combobox textbox not updating when binding changes.

I have a WPF CombBox as follows: <ComboBox ItemsSource="{Binding Source={StaticResource myList}}" SelectedItem="{Binding Path=mySelectedItem}" /> The problem I have is that when the bound value changes, the selected value in the combobox's textbox does not update. (Note - the values in the combobox list do update). I am using ...

How to get column value in selectedItems wpf?

I have many records from a database and i display it in a ListView. I need to delete it if I select it (multi-selection). But i need the Id (a column) to delete it and i can't get it. Please help^^ exemple: column: id name note ... 1 name1 note1 2 ... 3 ... if i select 1 and 3 I need to get the value (1 a...

Selected item in listbox unreadable because of the color

I dynamically create a collection of stackpanels in my listbox. In this stackpanel are contained labels and checkbox horizontally aligned. The problem is when I click on a stackpanel, the selection is unreadable because the line become dark-blue whereas the letters stay black so black on blue, you see nothing... how can I dynamically c...

UITabbar without controller

Hello. I have a simple app where the only view controller has an outlet to a UITabBar. It also implements UITabBarDelegate and is set as the delegate for the UITabBar: @interface TheMainViewController : UIViewController <UITabBarDelegate> { IBOutlet UITabBar *theTabBar; } I implemented the following method Which gets called wh...

How to keep an item selected? - ListView

Hello. I would like to keep an item selected, on a ListView, when the user clicks on a space which has no item. For example, the space below the items, but still on the ListView component. I've change the ListView property "HideSelection" to false, but that only works when the focus is changed to another component; not when the user clic...

Get currently selected item in Mac UI

I want to get the currently selected item (text, image, etc) and display in my Cocoa app's window when a keyboard shortcut is hit. Droplr has functionality like this, for example. How do I go about doing this? For example, I want it to return "(text, image, etc)" as text when that text selected on the screen like this: http://drp.ly/JAd...

WPF ComboBox SelectedItem - change to previous value

Hello, 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 ...

How to edit a selected SubItem programmatically?

Does anyone know how can I edit a subitem on a listView? I've tried using this: ListView1.SelectedItems[0].SubItems[1].Text = "Hello?"; But that doesn't work. I get the error "InvalidArgument=Value of '1' is not valid for 'index'". I've got two columns on the listview, so I figured the index of [1] would be the subitem. ...

WPF ListView SelectedItem is null

Hi All I have a Listview that has a checkbox as one of the columns. If I click anywhere but the actual checkbox the SelectedItem of the ListView is set to the current selected row, as expected. If, on the other hand I click onto the checkbox (without clicking on the row first) then the SelectedItem is null or the previously clicked row....

Casting SelectedItem of WPF Combobox to Color causes exception

I have a combobox databound to the available system colors. When the user selects a color the following code is fired: private void cboFontColour_SelectionChanged(object sender, SelectionChangedEventArgs e) { Color colour = (Color)(cboFontColour.SelectedItem); } This throws a Casting Exception with the following message: "Specifie...