Janus 2 GridEx disable a Button in a given cell - janus

There isn't much support with Janus, thats why i'm asking you for help.
I have a gridEx with 3 columns(INT ID, String MARKET, Button DELETE). when you add an item to the grid you only have to add the ID and MARKET, the button DELETE is automatically created and enabled.
What i want is for the element with ID=5 the button of that row must be disabled.
the data of the gridEx has a DataSource but is only binded with ID and MARKET.
the Data configuration of the GridEx Designer of the cell button DELETE the Bound is False and it hasn't got any DataMember.
What i have is the element wiht ID=5 but i don't know how to programatically disable the cell Button of that element in the grid.
Any clue of how to accomplish this issue???
Thanks!!

You have to utilize the FormattingRow event of the grid.
This is a sample code:
private void grdex_FormattingRow(object sender, RowLoadEventArgs e)
{
if (e.Row.RowType == Janus.Windows.GridEX.RowType.Record)
if (Convert.ToInt32(e.Row.Cells["ID"].Value) == 5)
e.Row.Cells["DELETE"].ButtonEnabled = false;
}

Related

Windows Form Listview is not visually showing selected items

We have a tool that is being integrated into our application. We have some strict borders around us too in that we cannot modify the application except for our extensions. I have searched here, I've searched the internet, but cannot find any postings about this problem.
I have a Windows Form that contains a ListView and our user requires we create a checkbox to Select/Deselect all. I have the event handler for when the check box state changes and call the routine to set everything to Selected.
private void SelectAllEventHandler(object sender, EventArgs e)
{
ChangeState(RadCapListView, SelectAllRadcap.Checked);
}
private void ChangeState(SWF.ListView control, bool state)
{
if (control.CheckBoxes)
{
control.Items.OfType<SWF.ListViewItem>().ToList()
.ForEach(item => item.Checked = state);
}
else
{
control.Items.OfType<SWF.ListViewItem>().ToList()
.ForEach(item => item.Selected = state);
}
control.Refresh();
}
Going into debug mode all items are marked as selected.
Also at the control level SelectedItems is properly updated.
The issue is that visually the control just will not highlight the selected items like we have our WPF forms doing. As you can see in the code I also tried to refresh the control hoping that would show items selected, but no joy.
Has anyone solved this problem in getting selected items to display properly?
Thank!
Instead of using control.Refresh(), try control.Focus().

How to control the form size expansion without events

I have a windows form with 6 textboxes. On the form load, by default, only one textbox will be displayed with the form size reduced. Once i enter the text into the textbox, my form size should increase and should display second textbox without any button click or textbox events. The intention behind it is that user doesn't put any extra effort to click button as it should be user friendly. Is there any possible ways of doing it?
No, it is impossible to do it without events, but possible without button clicks (which are actually producing events which should be handled)
So the most user friendly thing you can do is using events and where is no reason to avoid them. To achieve your functionality you have to
a) Set the Autosize property of the form to true
b) Handle the TextChanged event of your only textbox with following code:
private void textBox1_TextChanged(object sender, EventArgs e)
{
if(((TextBox)sender).Text.Length > 0)
{
TextBox tb = new TextBox();
tb.TextChanged += new EventHandler(textBox1_TextChanged);
this.Controls.Add(tb);
}
}

List item unresponsive on second click event

In my Windows Phone 7 application I have a number of list views. Each listViewItem has a click event (By setting 'selectionChanged' attribute to the listBox in my xaml). Now a very peculiar thing happens:
When I click on an item in the listbox the first time everything goes well, in this case the user gets taken to another screen. When I go back from that screen to the listbox, I select the very same listboxitem but this time the event doesn't register, nothing happens...
I then first have to tap on another item, let that ones even fire, then only can I tap on the first item. So in other words, I can't fire a click event for a listItem twice in a row. I'm thinking it's because the event handler on the listbox says 'onSelectionChanged', if you select the same item the selection hasn't technically changed.
So what other eventHandling attribute can I use on my listbox to register selection events on it's items?
Thanks for any help!
AFAIK, Theres is no such event. So, the work around is,
In the OnNavigatedTo event handler of the first page, set the SelectedIndex to -1
YourListBox.SelectedIndex = -1;
And while doing so, make one small modification to your Selection_Changed handler
void Selection_Changed(...)
{
if(YourListBox.SelectedIndex == -1)
return;
//rest of your code
}
In your case, SelectedItem in the ListBox is set for the first time. The second time you tap on the same item, technically its not a SelectionChanged event, hence its not firing.
Clearing the SelectedItem at the end of SelectionChanged event would do the trick.
Below is a code snippet that could be helpful,
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
//
// do your stuff here
//
//reset the selection of the sender (ListBox)
(sender as ListBox).SelectedItem = null;
}

How can I set a property for AutoMouseScroll and Mouse hower property to UltraDropdown?

I am using UltraDropDown control to bind a column of one UltraGrid control to list People category in list format.
This drop-down control have more than 25 items and show 8 categories Max, it's very fine. Now whenever I click on drop-down control to see all people category list then i have to hold scroll bar and drag down to see all categories. but I want to show all categories when I mouse scroll and its automatically move up and down to show all, and one more thing I want, when i mouse hover on listed categories then hover item should be shaded or colored.
Please help on both topic.
Thanks & Regards,
Shashi Bhushan Jaiswal
I believe that the first requirement is by default as behavior. Are you handling the MouseWheel event for this to not work?
Here is the code for your second requirement but I do not know if it is a good approach to use the MouseHover event as you like but this is your requirement:
void ultraDropDown1_MouseHover(object sender, EventArgs e)
{
if (cell != null && isInItem) {cell.Cell.Appearance.BackColor = Color.Red;}
}
CellUIElement cell;
bool isInItem = false;
private void ultraDropDown1_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e)
{
if (e.Element is EditorWithTextDisplayTextUIElement && e.Element.Parent.Parent is CellUIElement)
{
cell = (CellUIElement)e.Element.Parent.Parent;
isInItem = true;
}
else isInItem = false;
}

ListBox Menu in Windows Phone 7

Howdy,
I want to make a dynamically filled Menu in Windows Phone 7. I thought that a listbox would be the perfect fit for that. However, I cannot get the "selectedValue" once the user interacts with the listbox - hence I cannot give any information to the navigationhandler.
How can I create a ListBox whose Listbox Items are created dynamically and navigate the User on click to the same page but with different parameters e.g.
\informations.xam?id=2
Not that long ago I wrote an WP7 application and I used something like this:
private void CategoryList_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (CategoryList.SelectedIndex == -1) return;
string id = (CategoryList.SelectedItem as DepartmentViewModel).ID;
NavigationService.Navigate(new Uri("/Views/CatalogueBrowser/CategoriesPage.xaml?deptId=" + id, UriKind.Relative));
CategoryList.SelectedIndex = -1;
}
Basically, I set my listbox's itemssource to an observable collection of particular view models, then you just access the selected view model object using the SelectedItem property of the listbox.
Create a new "Windows Phone Databound Application" and the boilerplate code generated as part of the project will show you how to do this.

Resources