ToggleSwitch is being rendered this way because you are setting the width and height to be less than the MinWidth and MinHeight of the ToggleSwitch. When you do that, the rendering goes awry.
Since you are using the predefined style, in that style the MinWidth is set to 50 and the MinHeight is set to 30. you need to set the MinWidth and MinHeight to values lower than the Width and Height, like this
I have this up and running now, very nice effect, thanks.
Is it possible that the drag only happens when the user has started to drag an item rather than immediately on left mouse down? This way we can select, interact with items and not have them popping out to be dragged if the user simply wants to interact with them.
I am quite new to WPF and have got WPFSpark Installed but I am having difficulty in understanding how the FluidWrapPanel works. Am I to create my own Drag/Drop events which somehow makes the FluidWrapPanel move items out the way when a drag occurs or is Drag/Drop built in by simply adding the behavior to a UserControl as you show:
Have a look at the WPFSpark source code in GitHub. There you will see the solution contains two projects - WPFSpark.NET46 and WPFSparkClient.NET46.
The WPFSparkClient.NET46 contains the demo code which shows how the various controls in the WPFSpark library have to be used.
In order to support drag and drop within the FluidWrapPanel, add the FluidDragBehavior to each of the children. Just have a look at how FluidItemControl class is implemented in the WPFSparkClient.NET46 project. You can add the behavior declaratively in XAML
Got it working great now. I had a NullReferenceException in WPFSpark before but that was because I forgot to remove the code-behind that added the behavior (basically was adding it in xaml AND code). Doh!. All working now though. Thanks
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
PM> Install-Package WPFSpark
Attempting to gather dependencies information for package 'WPFSpark.220.127.116.11' with respect to project 'TestWPFSpark', targeting '.NETFramework,Version=v4.6'
Attempting to resolve dependencies for package 'WPFSpark.18.104.22.168' with DependencyBehavior 'Lowest'
Resolving actions to install package 'WPFSpark.22.214.171.124'
Resolved actions to install package 'WPFSpark.126.96.36.199'
Install failed. Rolling back...
Package 'WPFSpark.188.8.131.52 : ' does not exist in project 'TestWPFSpark'
Package 'WPFSpark.184.108.40.206 : ' does not exist in folder 'c:\users\me\documents\visual studio 2015\Projects\TestWPFSpark\packages'
Install-Package : Could not install package 'WPFSpark 220.127.116.11'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6', but the package does not contain any assembly references or content files that are compatible with that framework. For more
information, contact the package author.
+ Install-Package WPFSpark
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
I changed my target framework .NET 4.6.1 under Visual Studio 2015.
Restart Visual Studio and tried, and it won't install.
"Could not install package 'WPFSpark 1.3.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."