I was wonder if there was any method in which I can access an element which the user removes. For example when the InkCanvas is set to Select users can select elements and press delete to remove them. Is there any way of getting to this item if they deleted it? Any help is much appreciated.
Cheers,
Nilu
Update
#Drew: Not really. Say for example I have an image on the InkCanvas. I have some strokes attached to this image. If the user selects the image and then deletes it, I want the strokes to be removed.
Does handling the StrokeErasing event not give you what you want? You should be able to access the Stroke being erased from the InkCanvasStrokeErasingEventArgs::Stroke property.
Related
There are two user controls
1. First User control, having only Datagrid views only
2. Second User control, having the Details & operations like addition, modification & deletion button.
Both the user control will be placed in the Main window.
Whenever i am selecting a row in the grid particular data is displayed in the second user control (Using PRISM eventAggregator). But when adding or updating or deleting it is not happening updating the first user control data grid. How to achieve this.
Use the ObservableCollection it represents a dynamic data collection that gives a notification when items get added or removed.
If you are already using this which is not clear from your question, then you should check if you are using the INotifyChanged correctly or give us some code so we can help you.
But with the ObservableCollection and the INotifyChanged you should be able to solve your own question.
I've done some digging in trying to solve this, but haven't yet found a solution that works for me.
Basically I have an <ItemsControl> and in the <ItemsControl.ItemsTemplate> I have a <ListView> which displays a number of people's names. There will always be between 0 and 5 people's names listed.
What I want to do is have a tooltip popup with additional information relevant to the entity that is being hovered over. How do I get the index (or the content like the name) of the item I am currently hovering over though, to ensure that what the tooltip is displaying is for the correct person?!
I have a MouseEnter event on the listview which is triggered every time the mouse moves over an entity & in debug mode I can explore down into the sender details & can find the person's name that I want, but how do I get to it from code?
What I want is something like:
int index = sender.GetCurrentlyHoveredOverItem();
I don't want to overcomplicate this post by listing everything I've tried, but if you want any further info, please let me know.
Thanks in advance for your help!
As others have hinted at, but not explicitly said, the items in the ListView should implement the tooltip directly, using an ItemTemplate if needed, rather than at a global level.
<ListViewItem ToolTipService.ToolTip="Tooltip for this item" />
So you have a collection (ItemsControl) of lists (ListView) and you need the tooltip to be specific to a specific element within one of the internal lists, did i understand that correctly?
If so, why not create a ListView.ItemTemplate to take care of that?
If you are using MVVM…
Bind IsMouseOver to a property in the VM, like "CurrentlyHoveredPersonList". Use OneWayToSource.
Create another VM property called "HoveredPersonListViewModel" that contains all the details you need for your tooltip. When CurrentlyHoveredPersonList gets set, populate HoveredPersonListViewModel and raise a property change notification. You'll get an actual reference to the object, so you might not need the index, but if you do you can use IndexOf(object) to get it from the source list right there in the view-model.
Bind the tooltip's DataContext to HoveredPersonListViewModel and its constituent controls to the appropriate properties thereof.
I was wondering that currently we have gtk.TextViewWidget to display the contents of widget. I was wondering is there any way to make a type of My Computer Properties dialog box where there are different panels at top and one can click on any one of them to display the contents of that property.
Can anyone give me some good advice on how to proceed making this?
Sounds like you need a GtkNotebook.
I'm not sure I understand fully what you mean, but it sounds as if you could easily just stack a GtkTreeView on top of a GtkTextView to achieve what you want. Populate the tree view with a suitable model holding the items in your computer (how to find this information is of course a separate problem), and then as a tree item is clicked, modify the text view's buffer to display the associated information.
I'm thinking of CTR-Clicking each item to build up an array to add.... or even more fancy, drag select an area of items (don't think this is possible tho).
I'm aware of the custom events such as ItemDoubleClicked, but is there something like ItemSingleClick, where I can check if the CTR/SHIFT key is being pressed before executing an action.
I guess there is no possible way to customise the pivot since it is not open source... and the only method I can use is the doubleClick (plus match a keyboard key)...
I don't even like the way it zooms in right away after single clicking on an item.
I'm still open to suggestions (who knows... the pivot will probably still evolve), but otherwise, this thread I'm closing.
Ok I feel like I am just missing something small here, but it has taken me too long to figure this one out.
I have a custom UserControl that has a drop shadow. This UserControl is then used as the view to create a ModelUIElement3D. The drop shadow works perfectly when first displaying. The trick here is that I want to be able to change the direction of the shadow programmatically.
I have set up a binding to the ShadowDirection property that I know is working correctly, so I am left to believe that the problem lies in my view not updating. I have tried to invalidate the ModelUIElement3D, the UserControl, and the Window they all sit in, but have had no success.
Anyone know where I might be going wrong?
Thanks in advance.
Rick
Does the object to which ShadowDirection is bound implement INotifyPropertyChanged?
If not, the UI will never pick up changes from the bound object.