Silverlight Usercontrol in Datagrid does not fire the CellEditEnded event - vb.net

I have a UserControl that is displaying in a DataGrid. It contains a DatePicker and a Button that opens a Popup control where the user makes a selection that once selected populates a textblock with the result. The DatePicker is the only object that if changed will set off the CellEditEnded event. How can I get the popup controls selectionChanged event to tell the Datagrid that the cell has done as edit?

Turns out I was putting the UserControl inside the CellTemplate when I needed to put something else in that for display and my UC in the CellEditingTemplate. Now it fires as it should. I missed something simple and I should not have. Hope this helps someone else.

Related

How to prevent CheckBox getting clicked while ComboBox is closed?

I have a ComboBox which has a CheckBox control as a DataTemplate, and with that when the user tries to open ComboBox they sometimes accidentally end up selecting/deselecting the ComboBox, So what I want to do is to disable that behavior and open the ComboBox menu instead.
My ComboBox looks something as below:
Is there any way to achieve that? I tried modifying ItemTemplate of the ComboBox but so far didn't find any solution for it.
For now what I can do is just to bind CheckBox IsEnabled property with ComboBox IsDropDownOpen property, but if there's any better solution which you can suggest would be helpful.
Instead of toggling IsEnabled you should toggle IsHitTestVisible property of your checkbox. So when it is set to false it will not receive any mouse click events, but it will still look enabled because it still can receive keyboard events. So if you use tab navigation to tap it then it would work.

DataBound ComboBox not changing when an item is selected

I have a DataBound ComboBox and everything on it works great. But when I select an item in the list, the SelectedValue changes correctly but the text that gets displayed stays on the first item.
There is no code behind this, I added the DataBinding in the form builder.
It was a dumb mistake.
I had the SelectedValue set in the DataBinding Menu.

Don't autoscroll on button click

I am working on an application that works as a dashboard. The form includes a flowlayoutpanel that contains several datagridviews. The flowlayoutpanel is set to autoscroll because there are usually more datagrids than will fit on the visible page. Each datagrid has a buttonclick event that opens a chart form when a particular column (3) is selected. All of the chart functionality works fine. The problem I'm having is that when I click a datagrid that is only partially visible, the page scrolls to bring that datagridview completely onto the page. Because that happens on the click (MouseDown), the page scrolls so quickly that it doesn't actually trigger the clickevent, but selects several cells in the column, as if the user did a click/drag down the column.
What I would like to have happen is when the user clicks on a datagridview that is only partially visible, the chart would open, then the page would scroll on the chart close event. That actually happens if the datagridview in question has focus, but is partially off the page. For example, if I selet the datagridview, then scroll down/up until it is partially off the visible page, then click a cell in column 3. It will display the chart, then autoscroll when I close the chart. But if the datagridview does not have focus, it does the autoscroll thing. I have tried putting the flowlayoutpanel inside another panel, and that worked to some degree, but it was inconsistent.
Sorry for the long description, but I'm trying to be as detailed as possible. Any help would be greatly appreciated. The application is being built in .NET, using VS 2013.
This seems similar to a issue I had with multiple datagridviews inside a panel, this article was the solution for me.
In short, all you need to do is create a custom panel and override the ScrollToControl method. I belive you can do the same with a FlowLayoutPanel.
EDIT:
Your CustomPanel class should look something like this (code converted with developer fusion
Public Class CustomPanel
Inherits System.Windows.Forms.FlowLayoutPanel
Protected Overrides Function ScrollToControl(activeControl As System.Windows.Forms.Control) As System.Drawing.Point
' Returning the current location prevents the panel from
' scrolling to the active control when the panel loses and regains focus
Return Me.DisplayRectangle.Location
End Function
End Class
If this doesn't work you could try inheriting a regular Panel and place a FlowLayoutPanel inside it.

vb.net winforms datagridview how to tell where the user clicked in a cell

I am adding a custom column to a custom datagridview. One of the options this new datagridcolumn has is the ability show a value and then a button to allow the user to click on the button and something will happen. The button only takes up the right portion of the cell and the rest is a value. This button and value are displayable always and the button should always be able to be clicked on. In datagridview's display mode the value and button are painted. What I need help on is how to tell whether the user clicked on the button portion of the cell. Can someone please provide example code on how to do this?
Thanks,
Greg
Never mind I figured it out. I just put some logic in the cellclick event of the datagridview to get the GetCellDisplayRectangle and converted that to screen points and got where the mouse is on the screen and did a bounds test with the rectangle contains method.

How can I link a Button to a TreeView?

Hi everybody i'm new in this,i'm doing the designing a program(don't know barely nothing of coding), i need to link a button to a TreeView to appear,so when i click the button the treeview shows,when clicking other button,another treeview appears.
How can i do this?
Thanks
Im newbie!
Name the tree view controls with an x:Name attribute in the XAML. This will give you an instance which you can manipulate from code behind.
Subscribe to the click event of the button.
Set the Visibility property of the tree view to Visibility.Collapsed or Visibility.Visible in the click handler code.