HandyControls | Contains some simple and commonly used WPF controls | Theme library
kandi X-RAY | HandyControls Summary
kandi X-RAY | HandyControls Summary
This project is based on HandyControl and includes some controls and features that are not included in the original project [for example support for Persian Calendar and PersianDate, More Controls and More Styles] See what's there.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of HandyControls
HandyControls Key Features
HandyControls Examples and Code Snippets
Community Discussions
Trending Discussions on HandyControls
QUESTION
I have a .NET 5 project with following Nuget Packages:
- HandyControls for UI
- Gong-Wpf-DragDrop for Drag and Drop elements in a List
I have a XAML with a
ListBoxand a ViewModel with a
ObservableCollection` of Model.
The ObservableCollection
is binded as ItemSource
of ListBox
What I want to achieve:
When i Drag and Drop an item in a different position (or Add/Delete), I want the indexes to be refreshed.
Example:
Before Drag/Drop
After Drag/Drop
Actually, i binded the drophandler of gong-wpf-dragdrop and at the end of the drop, i manually refresh every single Index in my list.
there is a way to do it easily? because actually i have to refresh indexes manually.
Summarizing: When i reorder/delete/add items i want Model.Index of every item updated with the correct index position in ListBox.
My Mandate is:
- Show index (one based)
- Give the possibility to reorder the elements
I tried looking for similar questions but didn't find much that could help me. Thanks in advance :)
Model:
...ANSWER
Answered 2021-Sep-07 at 12:55I don't believe there is an out-of-the box way to bind to a container index in WPF. Your solution is actually easy to understand.
If you find yourself binding often to index, you could create your own attached property/value converter that internally climbs up the visual tree using these helpers until it finds the parent ItemsControl
and makes use of the IndexFromContainer
method.
Here is some code to get you started with this method:
First a small helper function to climb up the visual tree looking for an item of generic type:
QUESTION
I want to find the parent of usercontrol from Markup, I used the following code
...ANSWER
Answered 2021-Apr-06 at 12:38You need to wait until the UserControl
has been loaded before calling Window.GetWindow
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install HandyControls
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page