Search Results

Search found 9 results on 1 pages for 'justabill'.

Page 1/1 | 1 

  • WPF 4, ListView and ListCollectionView custom sorting

    - by JustABill
    I'm trying to use a custom sort with a ListView, as described in this blog entry. I'm doing ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(TheList.ItemsSource); as recommended there and in several other places, but for some reason I'm getting "Unable to cast object of type 'MS.Internal.Data.EnumerableCollectionView' to type 'System.Windows.Data.ListCollectionView'." (TheList is of type ListView). What could be causing this?

    Read the article

  • Problems with "global" exception handlers for unhandled exceptions in multithreaded WPF

    - by JustABill
    I have a program that, among other things, needs to be able to refresh the contents of a directory when the user tells it to. The actual task doesn't really matter, but this is the simplest way of causing this problem to occur that I know of. If I tell it to open a directory that doesn't exist, I get the "unhandled exception" dialog in VS with a stack trace of, from outer to inner: [External code] Textbox PreviewKeyUp event [External code] ClassA's path property being set ClassA's internal path update function being called A call to the INotifyPropertyChanged event [External code] A call to the getter for ClassB's list of children A call to ClassB's internal directory list function And then it fails inside this internal function. I have the following in my App.xaml.cs: private void Application_Startup(object sender, StartupEventArgs e) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.Current.Dispatcher.UnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Dispatcher_UnhandledException); } But neither of their exception handlers are being called. If I run this program from outside VS, I don't get notified of an exception at all, it just breaks because of the invalid input. And yes, the Application_Startup event is being called. How can I properly "trap" this exception so I can provide a friendly error message and kill the program?

    Read the article

  • Drag and Drop to explorer causing invalid FORMATETC (DV_E_FORMATETC) error

    - by JustABill
    I'm trying to use this excellent example to implement dropping virtual files into Windows Explorer. However, I'm stymied by this error. Towards the bottom, inside void System.Runtime.InteropServices.ComTypes.IDataObject.GetData(ref System.Runtime.InteropServices.ComTypes.FORMATETC formatetc, out System.Runtime.InteropServices.ComTypes.STGMEDIUM medium) on the first call to ((System.Runtime.InteropServices.ComTypes.IDataObject)this).GetDataHere(ref formatetc, ref medium); I'm getting back a DV_E_FORMATETC error. As far as I can tell, all the elements of the FORMATETC struct that are being passed in are valid: cfFormat is "Shell IDList Array" (-16141), ptd is 0, dwAspect is DVASPECT_CONTENT, lindex is -1, and tymed is TYMED_HGLOBAL. I'm kind of confused how there'd be a problem anyway, since this was generated by explorer. I know very little about COM interaction, so any help would be greatly appreciated.

    Read the article

  • How to create a "Shell IDList Array" to support drag-and-drop of virtual files from C# to Windows Ex

    - by JustABill
    I started trying to implement drag-and-drop of virtual files (from a C# 4/WPF app) with this codeplex tutorial. After spending some time trying to figure out a DV_E_FORMATETC error, I figured out I need to support the "Shell IDList Array" data format. But there seems to be next to zero documentation on what this format actually does. After some searching, I found this page on advanced data transfer which said that a Shell IDList Array was a pointer to a CIDA structure. This CIDA structure then contains the number of PIDLs, and a list of offsets to them. So what the hell is a PIDL? After some more searching, this page sort of implies it's a pointer to an ITEMIDLIST, which itself contains a single member that is a list of SHITEMIDs. My next idea was to try dragging a file from another application with virtual files. I just got a MemoryStream back for this format. At least I know what class to provide for the thing, but that doesn't help at all for explaining what to put in it. So now that that's explained, I still have no idea how to create one of these things so that it's valid. There's two real questions here: What is a valid "abID" member for a SHITEMID? These virtual files only exist with my program; will the thing they are dragged to pass the "abID" back later when it executes GetData? Do they have to be system-unique? Why are there two levels of lists; a list of PIDLs and each PIDL has a list of SHITEMIDs? I'm assuming one of them is one for each file, but what's the other one for? Multiple IDs for the same file? Any help or even links that explain what I should be doing would be greatly appreciated.

    Read the article

  • How to perform "shell" icon embedding in Visual Studio 2010?

    - by JustABill
    As far as I can tell, there have been (at least?) three types of icon embedding. There's the original style used by shell32.dll and friends, .Net's embedding, and the new type that WPF uses. I'm looking for how to perform the first one, as I want to have a few other icons available as resources for a jumplist, which can only accept that style. However, I can't figure out how to embed in this style, only the other two. How do I do this? All the results I find on google, etc are for adding icons to ResX files or similar. I am using C#, if it matters.

    Read the article

  • How to modify TaskDialog's Show() call to be blocking and return a value when closed?

    - by JustABill
    I'm using the WindowsAPICodePack's TaskDialog implementation, but it bugs me that I have to listen to click handlers on its buttons for even the more basic implementations. I'd like to convert/wrap it so that like the old MessageBox it blocks until closed and then returns a value based on what was done. Is there anything I can read for the basics on how to do this? I just have no idea where to even start, as I am admittedly not that familiar with the Win32 underpinnings.

    Read the article

  • How to treat compressed folders as files using ShellObject from WindowsAPICodePack?

    - by JustABill
    I am trying to implement a filesystem browser using the WindowsAPICodePack for C# (.Net 4), and it works pretty well, except that the ShellObject system treats zip files as folders, whereas I'd prefer they be files. Is there some way I can force it to work this way? The low-level interop it does is beyond me. As far as I can tell, internally it asks if the item is a Folder or a Filesystem element. It then uses this (and some type checks) to figure out what it actually is. Is it safe to force it to treat it as a file if it's Compressed? Or do I have to do something else?

    Read the article

  • Wpf binding to a function

    - by carlopenid
    I've a created a simple scrollviewer (pnlDayScroller) and want to have a separate horizontal scrollbar (associated scroller) to do the horizontal scrolling. All works with the below code accept I need to bind the visibility of the associated scroller. I can't simply bind this to the visibility property of the horizontal template part of the scroll viewer as I've set this to be always hidden. The only way I can think to do this is to bind the visibility of the associated scroller to a function such that If associatedScroller.scrollableWidth > 0 then associatedScroller.visibility = visibility.visible else associatedScroller.visibility = visibility.collapsed end if Is this possible to do and if so how do I do it? Private Sub pnlDayScroller_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles pnlDayScroller.Loaded Dim binViewport, binMax, binMin, binSChange, binLChange As Binding Dim horizontalScrollBar As Primitives.ScrollBar = CType(pnlDayScroller.Template.FindName("PART_HorizontalScrollBar", pnlDayScroller), Primitives.ScrollBar) binViewport = New Binding("ViewportSize") binViewport.Mode = BindingMode.OneWay binViewport.Source = horizontalScrollBar associatedScroller.SetBinding(Primitives.ScrollBar.ViewportSizeProperty, binViewport) binMax = New Binding("Maximum") binMax.Mode = BindingMode.OneWay binMax.Source = horizontalScrollBar associatedScroller.SetBinding(Primitives.ScrollBar.MaximumProperty, binMax) binMin = New Binding("Minimum") binMin.Mode = BindingMode.OneWay binMin.Source = horizontalScrollBar associatedScroller.SetBinding(Primitives.ScrollBar.MinimumProperty, binMin) binSChange = New Binding("SmallChange") binSChange.Mode = BindingMode.OneWay binSChange.Source = horizontalScrollBar associatedScroller.SetBinding(Primitives.ScrollBar.SmallChangeProperty, binSChange) binLChange = New Binding("LargeChange") binLChange.Mode = BindingMode.OneWay binLChange.Source = horizontalScrollBar associatedScroller.SetBinding(Primitives.ScrollBar.LargeChangeProperty, binLChange) End Sub Private Sub associatedScroller_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.RoutedPropertyChangedEventArgs(Of Double)) Handles associatedScroller.ValueChanged pnlDayScroller.ScrollToHorizontalOffset(e.NewValue) end sub FOLLOW UP (thanks to JustABill) : I've add this code into the pnlDayScroller sub above (I've discovered scrollableWidth is a property of scrollviewer not scrollbar, but the maximum property gives a result I can use instead) binVisibility = New Binding("Maximum") binVisibility.Mode = BindingMode.OneWay binVisibility.Source = horizontalScrollBar binVisibility.Converter = New ScrollableConverter associatedScroller.SetBinding(Primitives.ScrollBar.VisibilityProperty, binVisibility) and I've created this class Public Class ScrollableConverter Implements IValueConverter Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert Dim dblMaximum As Double If targetType IsNot GetType(Visibility) Then Throw New InvalidOperationException("The target must be a visibility") Else dblMaximum = CType(value, Double) Debug.WriteLine("Value of double is " & dblMaximum) If dblMaximum > 0 Then Return Visibility.Visible Else Return Visibility.Collapsed End If End If End Function Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack Throw New NotSupportedException() End Function End Class And the problem is resolved.

    Read the article

1