如何从Xaml文件读取后在Wpf应用程序中绑定事件处理程序 [英] How Can I Bind Event Handlers In Wpf Application After Reading From Xaml File

查看:100
本文介绍了如何从Xaml文件读取后在Wpf应用程序中绑定事件处理程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究wpf应用程序。我在表单上有一个画布并创建一些点,用户可以拖动任何节点并可以保存其状态。我使用xamlwriter.write来保存当前位置但是当我使用xamlreader.load加载它时,画布上的任何按钮都不起作用,任何节点都不再可拖动。我也使用内联按钮事件处理程序,但它不工作。需要任何解决方案

I am working on wpf application.I have a canvas on form and creating some points , user can drag any node and can save its state. I m using xamlwriter.write to save the current position but when i load it back using xamlreader.load any button on canvas are not working also any node is not dragable anymore . I have also used inline button event handler but its not working.Any solution needed

推荐答案

您好,在您的应用程序中遵循MVVM架构,将您的实体组织为类并使用绑定将对象绑定到UI。



要保存和检索,只需使用序列化保存对象,而不是保存UI。您可以通过反序列化来检索这些对象。



研究以下内容,

1. MVVM架构

2 。对象序列化和DeSerialization

3. WPF中的DataBinding

4. ObservableCollections
Hi, follow MVVM architecture in your application, organize your entities as classes and use binding to bind objects to the UI.

To Save and retrieve, instead of saving the UI, just save the objects using serialization. You can retrieve those objects by deserialization.

Study about the followings,
1. MVVM architecture
2. Object Serialization and DeSerialization
3. DataBinding in WPF
4. ObservableCollections


这篇关于如何从Xaml文件读取后在Wpf应用程序中绑定事件处理程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆