草庐IT

xaml-designer

全部标签

c# - 可以从 WebClient 继承而我的代码不是 "design time component"吗?

我有一段代码是这样的:publicclassNoFollowWebClient:WebClient{protectedoverrideWebRequestGetWebRequest(Uriaddress){varrequest=(HttpWebRequest)base.GetWebRequest(address);request.AllowAutoRedirect=false;returnrequest;}}不过,每当我将它添加到.cs文件时,VisualStudio2012都会以其无穷的智慧将我的C#源文件转换为“设计时组件”。因此,当我现在双击该文件时,我看到的不是我的C#代码,而

c# - 在 xaml 窗口和用户控件 WPF 之间传递参数

如何将参数从xaml窗口传递到WPF用户控件构造函数?我试过创建依赖属性,但没有成功。我应该尝试xaml扩展还是有其他方法吗?调用Window的xaml.cs,以及它的用户控件。publicpartialclassSomeView:UserControl{SomeViewModelvm=newSomeViewModel();publicSomeView(){this.DataContext=vm;InitializeComponent;}}上面窗口的InitializeComponent在创建用户控件的实例之前清除通过xaml设置的依赖属性的值,因此依赖属性的值始终为null。和用户控

c# - 在 WPF 中以编程方式将用户控件/页面添加到 Windows xaml

我想在Window1.xaml(主窗口)中以编程方式在我的两个用户控件AddUsers.xaml(用户控件)和Viewusers.xaml(用户控件)之间切换。我正在尝试通过Window1.xaml中的按钮事件切换用户控件。我的窗口1。xaml是这样的我有两个用户控件addUser.xaml和viewUser.xaml添加用户。xaml代码:和我的第二个用户控件viewUser.xaml 最佳答案 首先你需要给你的堆栈面板一个名字然后你需要类似于的东西publicpartialclassMainWindow:Window{priva

c# - 如何访问 WPF Xaml 中的控件引用?

我有一些控件,我将它们的Name属性设置为唯一的名称,但我无法在匹配的C#代码文件中访问它们。我试过:this.ControlNameMainWindow.ControlNameControlName但它确实“看到”了它们。我该怎么做?另外,我是否必须为环绕面板、GridView等内的嵌套控件做一些特殊的事情?编辑:usingSystem;usingSystem.Collections.Generic;usingSystem.Collections.ObjectModel;usingSystem.Linq;usingSystem.Text;usingSystem.Windows;usi

c# - 在 WPF 中,我如何实现 ICommandSource 以使我的自定义控件能够使用来自 xaml 的命令?

您能否提供一个示例,说明您如何实现ICommandSource接口(interface)。因为我希望我的UserControl具有此功能,它没有在xaml中指定命令的能力。并能够在用户单击CustomControl时处理命令。 最佳答案 这是一个例子:publicpartialclassMyUserControl:UserControl,ICommandSource{publicMyUserControl(){InitializeComponent();}publicICommandCommand{get{return(IComma

c# - 如何在 Xaml 文件的 Xamarin.Forms 中添加复选框?

我是xamarin.forms的新手,我需要添加一个复选框、单选按钮和下拉列表。我尝试了一些来自网络的样本,但我无法获得复选框。谁能帮助我在xamarin.forms中实现这一目标?Xaml文件或一些链接或示例代码将使它更容易理解。 最佳答案 我找到了一个更好的方法来做到这一点,那就是创建你自己的。这真的很简单。在名为CheckBox的Resources项目(或任何你想要的地方)中创建一个cs文件并粘贴此代码:namespaceResources.Controls{publicclassCheckbox:Button{publicC

c# - System.Design 去哪儿了?

我正在制作一个使用ScintillaNet的C#项目,它说:Thereferencedassembly"ScintillaNet"couldnotberesolvedbecauseithasadependencyon"System.Design,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a"whichisnotinthecurrentlytargetedframework".NETFramework,Version=v4.0,Profile=Client".Pleaseremovereferencesto

c# - XAML 中的 ItemsPanelTemplate 忽略 [ContentProperty] 属性

我有一个自定义面板,我在其中声明了一个自定义属性来保存内容(我不想为内容使用子项):[ContentProperty(Name="PanelContent")]publicclassCustomPanel:Panel{publicstaticreadonlyDependencyPropertyPanelContentProperty=DependencyProperty.Register("PanelContent",typeof(Collection),typeof(CustomPanel),newPropertyMetadata(newCollection(),null));pub

c# - 编辑 Resources.resx 文件时,Resources.Designer.cs 无法更新,因为 TFS 未将其 checkout

我正在使用TFS源代码管理。当我向我的资源文件-Resources.resx添加一个新的资源key并点击保存时,TFScheckoutResources.resx但不checkoutResources.Designer.cs。这会导致对Resources.Designer.cs的更新失败并出现错误:Thecommandyouareattemptingcannotbecompletedbecausethefile'Resources.Designer.cs'thatmustbemodifiedcannotbechanged.Ifthefileisundersourcecontrol,yo

c# - 重用 XAML block 的最佳方法是什么?

我有很多这样的用户控件:PageManageCustomers.xaml.cs:publicpartialclassPageManageCustomers:BasePage{...}继承自:PageBase.cs:publicclassBasePage:UserControl,INotifyPropertyChanged{...}由于PageBase.cs没有随附的XAML文件,我必须将它引用的XAML放在每个用户控件中继承它,例如以下block在继承PageBase的每个控件的每个XAML文件中重复:我试图将此block放入一个资源文件,但语法不正确,它说:'ResourceDict