this is the code to find ribbon control
bool found = testRibbon.CommandTabs.Cast<RibbonTab>().Any(t => t.name == tab.Name);
now how can i find by name a RadRibbonBarGroup that is member of RibbonTab
The scenario is like this:
I have a ribbon control and i populate the tabs from modules
inside tabs i add RadRibbonBarGroup and inside RadRibbonBarGroup i add RibbonButtons
now to prevent duplicates i need to check if the tab exists and the ribonbargroup exist and has the button skip that tab and bargroup else add the button.. same should be for the tabs and bargroups.
That is the fastest way to achive this scenario
Can i do it via linq or should i iterate with for each witch is the best solution.
testRibbon.CommandTabs.Cast<RibbonTab>().Where(t => t.name == tab.Name)
.SelectMany(x => x.Groups.Where(g => g.Name == groupName));
Related
How can I make an owner-draw list control with checkboxes. What I need is:
I have data separate, each has a different color code. I need to add this to a list control with the format :
This allows multiple selection
[checkbox] [color code rectangle] Text_Item
I need to use checkboxes to select which I want selected.
I Should be able to select multiple items from listcontrol without having to use CTRL+Click.
I have tried using DrawFrameControl For getting the checkboxes.But using which we are able to select only one item at a time.Following is my code I have used in my drawitem method.
void OwnerdrawListCtrl::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
bool sel = (lpDrawItemStruct->itemState && ODS_SELECTED);
if
DrawFrameControl(*pDC, rcItem, DFC_BUTTON, DFCS_CHECKED);
else
DrawFrameControl(*pDC, rcItem, DFC_BUTTON, DFCS_INACTIVE);
}
This is how I am adding the checkboxes to my listCtrl.Im handling an NM_Click event in which Im setting the state of the ienter code heretem that is being clicked.
While pressing tab key the focus is getting moved through the tab control and the button but not going into the tabpages (tabPage1 and tabPage3)
Considering the fact that you can move between tabpages using arrow keys, Tab key is probably not intended to be used for this, but if you really want to get it to work this way then you should add a KeyDown event
if (e.KeyCode = Keys.Tab)
{
//logic which changes TabControl.SelectedIndex. If SelectedIndex equals max then select the next control
}
I have a Windows Forms GUI that has a bunch of controls, one of which is a FlowLayoutPanel containing a group of RadioButtons.
I can tab to the first RadioButton (TabIndex and TabStop set properly), but when I hit tab again it takes me to the next control on the form, not the next radio button in the FlowLayoutPanel.
Once the first RadioButton has focus, the only way to go through the group is to use up/down arrows, but that actually selects the RadioButton. Selecting a RadioButton kicks off some other stuff, so I just want a way to tab through the list to figure out what to select.
What I want, ideally, is to have each RadioButton act like any other control on the page and allow me to tab through the whole group without selecting a RadioButton until I hit Space.
This tab order is default Windows behaviour and it is rarely good practice to change this.
It happens as the Radio Buttons in a group have TabStop juggled to work this way.
To change this, explicitly set the Tab Stop to true every time it is reset:
public Form1()
{
InitializeComponent();
foreach (var control in this.flowLayoutPanel1.Controls.OfType<RadioButton>())
{
control.GotFocus += (s,a) => SetTabStops(flowLayoutPanel1);
control.CheckedChanged+= (s,a) => SetTabStops(flowLayoutPanel1);
}
}
private static void SetTabStops(Control host)
{
foreach (Control control in host.Controls)
{
control.TabStop = true;
}
}
My project contains some (Comboboxes with Checkboxes) binging to the same Observable Collection.
If I checked an Item from the Main Combobox I should filter/update the information from the other combo
TmpFilter.Where(m => m.CarID == "MINI").ToList();
And there is no problem, but if the user checks more than one option ("MINI", "AUDI" ... ), a list of options. I dont know how to make the query.
Can you please help me?
You can store the list of selected items from first combobox -
List<string> selectedItems;
And can check if item is present in the list using simple query -
TmpFilter.Where(m => selectedItems.Contains(m.CarID)).ToList();
I have a Telerik Ajax bound grid containing a Html.ActionLink for deleting a record. On clicking this link, a Telerik Window opens which is contained within a Html.BeginForm tag.
In this form, there is a telerik Window having 2 buttons "Yes" and "No" for confirmation. This thing works pretty much fine but only problem is that when I delete a record, the entire page is refreshed which is not required.
I am thinking about converting Html.ActionLink to Ajax.ActionLink and Html.BeginForm to Ajax.BeginForm.
How can I Ajax-enable my Html.ActionLink and Html.BeginForm?
You should use the built in grid features. In the databinding section, declare your delete action
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("_AjaxBinding","ControllerName")
.Delete("_AjaxDelete", "ControllerName")
)
Then add a command button to the columns array
columns.Command( o => o.Delete().ButtonType( GridButtonType.Text ) );
and that's it. Your delete action will delete the record (takes an int id parameter) and then return return _AjaxBinding(); at then end of the action.