I have a Telerik RadGridView and wish I could set some column's IsVisible property to false or true when I click a toggle button.
I can only get the column by grid.Columns[1].IsVisible = False.
I wanted to set it like this grid.Columns["ColumnName"].IsVisible, but failed. Is that possible?
I use x:Name = "ColumnName"
How can I set content property for this toggle button, for example as "Display" at first and when click it, content change to "Hide"?
You should use UniqueName instead of x:Name
Related
In windows form, I have 5-7 combobox on one 3 tab pages of tab control.
This tab control reside in a group box.
There are other two groupboxes containg other text box and listview controls.
Problem is, When defualt load the form control then focus set on combobox and unable to unselect.
Tried by changing property- causevalidation to false but no output.
Please guide.
Add a line on Page Load to set focus on the control you want to focus.
For Ex:
txtName.Focus();
EDIT
Use this
ActiveControl = yourcontrolNameToWhichYouWantToSetFocus;
You can set the TabIndex of the controls, the lowest index will be the first focused. (TabStop should be true)
I you want to set focus to another combobox you should call Select() method.
I have a WPF UI that has 3 i/p controls, 2 dtp and 1 chk box, user will select some value and click search button.
How can I pass values from both dtPicker and chkBox on Button click to a method defined in viewModel?
On click on button, control is coming over to method in view model but how to pass those selected values in method?
You don't need to pass anything, simply set up the bindings correctly.
DatePicker - SelectedDate
CheckBox - IsChecked
Then you'll probably use RelayCommand or something like that and you'll have an easy access to the viewmodel properties.
I create in DataGridView column DataGridViewComboBoxColumn.
I need set style DropDown.
this.combobox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
how do this?
Use DataGridViewComboBoxColumn.FlatStyle Property. The FlatStyle property affects the behavior and appearance of the drop-down arrows for the cells in this column.
dataGridViewComboBoxColumn.FlatStyle = FlatStyle.Flat;
I have a WPF DataGrid. The DataGrid is bound to an IList. The list has many many items so the DataGrid MaxHeight is set to a predefined value and the DataGrid automatically displays a scroll bar. The selection mode and unit are set to "single full row".
The form has a button called "New" that adds an item to the list that the datagrid is bound to.After "New" is clicked, the new item should be the new selected item. I do this via : dataGrid.SelectedItem = newItem;
This works ..but not as well as I expect it to.
I also want the dataGrid to scroll down to the newly selected item .. Any idea on how to do this ?
Regards,
MadSEB
After you set the SelectedItem, make sure to call DataGrid.ScrollIntoView with the new item. This will make sure that the new item is visible on screen.
I want to swap images on the button dynamically using mvvm light. When the page first loads,it should display the images as per the database values i.e. checked or unchecked. I have 2 columns for the images like ImageChecked and ImageUnchecked. By clicking on the button i.e checked or unchecked it should change accordingly.If it checked then unchecked n vice versa based on the database values.Images will load on button as Content.
Kindly Help?
Thanks
Are you trying to implement the functionality of checkbox using a button?
If so, you can take a look at the ToggleButton which has the IsChecked and Content properties so that you can change your content using a trigger based on the IsChecked property.
Else if you have the IsChecked property ready from the ViewModel then you can change the image of the button using the Image property using a DataTrigger.
Update
The hierarchy goes like this: ToggleButton->Image->BitmapImage. Set the urisource of the BitmapImage and set it as a source for an Image which in turn is set as a content of the ToggleButton. Do this in xaml. Check this link for creating an Image.
Now set the DataTrigger of the ToggleButton for IsChecked value True and change the BitmapImage's UriSource with the assistance of TargetName property.