design-time

Controls, properties, events and timers running in design time

[亡魂溺海] 提交于 2019-12-11 03:24:29
问题 Im using some custom control in vb.net, where I have a boolean property that, whenever it changes, it starts a timer if it's value is false or stops if it's true. If the timer runs for several seconds, it raises a messagebox that warns of a problem happening. The problem is that this messagebox shows even in design time. As I have traced, the default value for the property is false when the control loads in the winform in design time, it seems it starts the timer and when it ends raises the

UserControl with property of type Type

妖精的绣舞 提交于 2019-12-11 02:36:09
问题 I'm implementing a UserControl with a property of type Type . public partial class MyUserControl: UserControl { public MyUserControl() { InitializeComponent(); } public Type PluginType { get; set; } = typeof(IPlugin); } When placing MyUserControl on a form I can see the PluginType property in the designer, but I cannot edit it. How can I make this property editable? Ideally the designer would show an editor where I can pick one of the types in my assembly (or any assembly). Is there such an

Add Image file resource to another project

微笑、不失礼 提交于 2019-12-11 01:42:24
问题 I want to add/update Image resources in a .NET project, so that when the application is compiled the images will be available at runtime. Due to having a large amount of images in several locations I want to do this using a separate vb.net project. The only way I can see to do this is to copy the image file to the [Project]\Resources folder and then edit the [Project]\My Project\Resources.resx to use this image file, but this seems a bit hacky and I'm not sure how fussy Visual Studio is about

Can RTTI interrogate types from project code at designtime?

偶尔善良 提交于 2019-12-10 02:04:10
问题 I would like to use RTTI to examine the types contained within project source files at designtime rather than runtime. To the best of my knowledge this is unsupported but the discussion in the comments of this question indicate that it is possible and has been for several Delphi versions. This is the first time I have heard of this functionality being available though and as yet I have been unable to reproduce it for myself. Here is my test example. It uses a simple TListBox descendant

Is it possible to style text in a richtextbox at design time?

南楼画角 提交于 2019-12-09 12:29:51
问题 I have a System.Windows.Forms.RichTextBox that I wish to use to display some instructions to my application users. Is it possible to set some of the text I enter at designtime to be bold? Or do I have no option but to do it at runtime? 回答1: You can certainly create an RTF document in RTF editor (e.g. WordPad), save the file, open it as a text/plain file and copy the RTF document into the RtfText property of your RichTextBox at design time. But I advise against it. That way, you have a large

WPF user control throws design-time exception

独自空忆成欢 提交于 2019-12-09 10:07:06
问题 I have a userControl which starts a timer. It looks like the XAML designer is trying to call that code, which links to some back-end database stuff. I keep getting an unhanded exception error in the design screen. Any ideas how I can stop the designer trying to run the code? 回答1: XAML designer will call the UserControl's constructor when loading in designer. In order to avoid this you can place a if condition as follows in your UserControl constructor if(System.ComponentModel.DesignMode)

WPF Design-Time vs Run-Time Style Differences with Triggers

☆樱花仙子☆ 提交于 2019-12-08 17:32:26
问题 I am having a big issue with how XAML is rendered in Design-Time vs Run-Time. For the most part, things are consistent, but when I use any styles which have a Trigger, the trigger is not checked in Design-Time. Here is a sample application to show how things are displayed differently: <Window x:Class="DesignDifferencesWithDesignAndRuntime.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow"

providing designtime ViewModel data for Blend and VS

有些话、适合烂在心里 提交于 2019-12-05 20:31:54
In a MVVM based application, what options do I have to provide ViewModel data at design time, so our designers can actually see something in Blend3 (and VS 2008). How are you doing this? Can I utilize mc:ignorable for this somehow? Yes, Expression Blend can help you with this. Use the "Data" tab to create sample data that has the same shape as your production data. When you create the data source, be sure to uncheck "Enable sample data when application is running". Sample Data http://www.smips.com/brad/stackoverflow/design-model1.jpg After you've created your sample data, set the DataContext

Can RTTI interrogate types from project code at designtime?

不羁的心 提交于 2019-12-05 02:53:33
I would like to use RTTI to examine the types contained within project source files at designtime rather than runtime. To the best of my knowledge this is unsupported but the discussion in the comments of this question indicate that it is possible and has been for several Delphi versions. This is the first time I have heard of this functionality being available though and as yet I have been unable to reproduce it for myself. Here is my test example. It uses a simple TListBox descendant TMyListBox which has a string property TypeToExplore which when set fills the list box with the properties of

.NET Windows Forms design time rules

寵の児 提交于 2019-12-03 19:56:05
问题 I have an object that starts a thread, opens a file, and waits for input from other classes. As it receives input, it writes it to disk. Basically, it's a thread safe data logging class... Here's the weird part. When I open a form in the designer (Visual Studio 2008) that uses the object the file gets created. It's obviously running under the design time vhost process... The odd thing is I've not been able to reproduce the issue in another project. I'm not sure what the rules are for code