WPF .NET Core no touch behavior support
I’ve used WPF Framework for years and started a .NET Core 3.1 app. My first obstacle there doesn’t appear to be any touch screen behavior support that Framework did. This seems odd considering functions like touch translate and zoom are common. VS 2019 Blend shows the behavior, but doesn’t allow it to added. When the solution is loaded back in VS the dependency for interactivity that Blend added has warning/error icon. Has .NET Core implemented a different class or tool to support a common function of touch translate, pan and zoom with the fluid inertia effects that Framework did?
@brucek5: Is there a repro for this issue that does not required VS 2019 Blend? Thanks.
Since I can remember Visual Studio Blend has added behaviors and the required Framework references. Then going back into regular Visual Studio it would recognize the added functionality.
Even Visual Studio 2019 Blend, when loading a .NET Core 3.1 project, it gives you the option to install nugget package within the toolbox window itself. But I get Xaml editor errors when trying to add any of the behaviors. There doesn't appear to be any documentation on the topic except for Framework.
I can create my own touch control, but it's like reinventing the wheel.
Xaml behaviors is there for WPF. In fact I did the work :-) https://github.com/microsoft/XamlBehaviorsWpf/pull/20 I see the behavior here: https://github.com/microsoft/XamlBehaviorsWpf/blob/master/src/Microsoft.Xaml.Behaviors/Input/TranslateZoomRotateBehavior.cs It might not work in Blend though. Also note that the xaml behaviors live in the Microsoft namespace now.
Thanks Morten for the reply. One has to ask where does Blend 2019 fits in the bigger picture... It was adding, on it's own, a different package. I don't like switching between regular VS and Blend, but Blend has tools to create some Xaml easier, such as storyboards. Why not just add that functionality to VS and dump Blend?
Back to the subject. I looked at some of the examples of the new behaviors and see the syntax is different than what I see in my Framework Xaml files. See attached file. Where can I go to learn how to use the new syntax?
On a related topic, thinking I'd have to do my own touch manipulation, which worked, But it stopped working if a called a system.management function searcher.Get(). in the code below finding serial port description names: Any thoughts on why it stops touch manipulation? It doesn't in Framewoork.
using (var searcher = new ManagementObjectSearcher("SELECT * FROM WIN32_PnPEntity WHERE Caption like '%(COM%'"))
{
string[] portnames = SerialPort.GetPortNames();
var portsdesc = searcher.Get().Cast<ManagementBaseObject>().ToList().Select(p => p["Caption"].ToString());
portsdescp = portnames.Select(n => n + " - " + portsdesc.FirstOrDefault(s => s.Contains(n))).ToList();
for (int i = 0; i != portsdescp.Count; i++)
{
SerialLocoNetPortProperties newPort = new SerialLocoNetPortProperties();
newPort.PortDiscription = portsdescp[i].ToUpper();
newPort.PortName = portnames[i];
PortNameList.Add(newPort);
}
}
I believe they are all in the same namespace now so no need for both ei and i namespaces, but that's probably a better thing to ask over in the behaviors repo.
I'd assume this issue can be closed, as it pertains to an extension that is not part of WPF itself