custom-controls

Flag control properties as required in design view

两盒软妹~` 提交于 2019-12-20 03:10:02
问题 I'd like to force the consumer of a control to give a property a value when placing the control on a page. In VisualStudio when you create an < img > tag without attributes SRC or ALT on a user control, it gets underlined saying that SRC and ALT are required attributes. I assume this is just a special handling of the tag by the editor, but is there a way to define a similar behavior for controls? If the control had a property defined like this: public object AProperty { get { if (ViewState[

WPF Style/Template gets applied only to the last added element

社会主义新天地 提交于 2019-12-20 02:35:14
问题 I have a simple control derived from ContentControl with this code: public class HeaderFooterControl : ContentControl { static HeaderFooterControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(HeaderFooterControl), new FrameworkPropertyMetadata(typeof(HeaderFooterControl))); } public object Header { get { return (object)GetValue(HeaderProperty); } set { SetValue(HeaderProperty, value); } } // Using a DependencyProperty as the backing store for Header. This enables animation, styling,

Custom alert dialog android

南楼画角 提交于 2019-12-19 11:57:48
问题 I am working with custom alert dialog in android. I have followed the link 1 and linke 2. In my code using these styles. <style name="DialogAnimation"> <item name="android:windowEnterAnimation">@anim/slide_up_dialog</item> <item name="android:windowExitAnimation">@anim/slide_out_down</item> <!-- Animation for dialog box --> <style name="DialogSlideAnim" parent="AppBaseTheme"> <item name="android:windowAnimationStyle">@style/DialogAnimation</item> </style> From these styles I am getting

Access additional twitter user info

时光怂恿深爱的人放手 提交于 2019-12-19 11:18:23
问题 I'm using Azure Mobile Services to authorize users and am now trying to get additional user info from the providers. I have it working for all of them except Twitter. To authenticate for all the other I'm using something similar to this: var identities = await user.GetIdentitiesAsync(); var result = new JObject(); var fb = identities.OfType<FacebookCredentials>().FirstOrDefault(); if (fb != null) { var accessToken = fb.AccessToken; result.Add("facebook", await GetProviderInfo("https://graph

Drawing a blinking caret in Winforms

﹥>﹥吖頭↗ 提交于 2019-12-19 10:45:14
问题 I'm developing a custom control, which most resembles a text area. I am drawing text, which works correctly, and accepting input which also works.. But I (the user) am left guessing where the caret is while I type, since I'm doing everything manually. How do I draw a blinking caret to show where I am currently typing? Is there a standard way to do this? 回答1: I think that, annoyingly, there is no managed API for Carets. You must, therefore, either PInvoke to the Win32 functions for carets, or,

How to draw a circular progressbar pie using GraphicsPath in WinForm?

此生再无相见时 提交于 2019-12-19 09:41:15
问题 I want my custom circular progress bar in WinForm. But the result doesnt fit to what I think. How can I draw the shape as the same in this picture?. I uploaded two image to be clear in my problem. My code to do this: void Form1_Paint(object sender, PaintEventArgs e) { int angle = 120; e.Graphics.SmoothingMode = SmoothingMode.HighQuality; Rectangle outerRect = new Rectangle(50, 50, 100, 100); Rectangle innerRect = new Rectangle(70, 70, 60, 60); int innerRadius = innerRect.Width / 2; int

My control is “not allowed here because it does not extend class 'System.Web.UI.UserControl'”

谁都会走 提交于 2019-12-19 05:13:06
问题 So I have another noodle-scratcher (for me anyway). I'm trying to create my own custom control in a CMS I only have partial source code for (i.e. samples the vendor has supplied to me). Basically I have created a class called DataDefinitionContent which extends ControlBase . Now, from what I can garner from the metadata, ControlBase extends UserControl , so I would have thought this would run without a drama. Can anyone shed any light on why this might not be working for me? My Class: public

When I use custom stars for Android RatingBar, always show half star for decimal values below 0.5

旧城冷巷雨未停 提交于 2019-12-18 14:52:21
问题 I've looked up a number of posts (e.g. Android RatingBar change star colors, Change the color of the stars in the rating bar where the rating bar is created dynamically in android, How can I set the star color of the ratingbar?) in order to change the colours of the stars in the RatingBar. I followed the posts and was able to change the stars for the custom RatingBar, but in doing this I was no longer able to set the value to be a decimal lower than a half (e.g. 0.2). It would always show up

When I use custom stars for Android RatingBar, always show half star for decimal values below 0.5

安稳与你 提交于 2019-12-18 14:51:40
问题 I've looked up a number of posts (e.g. Android RatingBar change star colors, Change the color of the stars in the rating bar where the rating bar is created dynamically in android, How can I set the star color of the ratingbar?) in order to change the colours of the stars in the RatingBar. I followed the posts and was able to change the stars for the custom RatingBar, but in doing this I was no longer able to set the value to be a decimal lower than a half (e.g. 0.2). It would always show up

Transparent TCustomControl?

拈花ヽ惹草 提交于 2019-12-18 12:19:34
问题 I need to create transparent component inheriting from TCustomControl.. so it is custom painted, yet is container for other components. Can you tell me how to achieve this? 回答1: Inherit from TCustomTransparentControl and include csAcceptsControls control style at creation. 来源: https://stackoverflow.com/questions/6682396/transparent-tcustomcontrol