custom-controls

Converting a UserControl to a Custom Control

我的未来我决定 提交于 2019-12-10 10:31:49
问题 The UserControl below works well but I would like to make it easier to change the Style. One thing I have tried is to convert this to a Custom Control, but I am stuck on basics like how to set the ToolTip inside the static method that deals with a change in a property (see below) The other thing I tried to move the Style into a generic button style in the ResourceDictionary, but that is the subject of this question How can I set the ToolTip in my subclassed Button? Cheers UserControl XAML:

Creating Custom Controls with generics

让人想犯罪 __ 提交于 2019-12-10 09:54:08
问题 We wish to create a WinForms Custom Control (which is derived from a .net control) and be able to drag and drop it from the tool box in the designer view. However we are unable to this whenever we have a control with generics because when the designer tries to create an instance of the class, for obvious reasons, it doesn't know what type the instance must be of. Any one knows of a way around this ? Thanks in advance ======edit=========== What we would like to do is have example: public class

Required Property in Custom ASP .NET Control

大兔子大兔子 提交于 2019-12-10 09:28:02
问题 I am making a custom web control for my ASP page that inherits from CompositeDataBoundControl. I have a public property in the definition of my control that is required , if the user does not provide this property in the control definition on an ASP page it will break and we will get an exception. I want the compiler to throw a warning similar to the one when a user forgets to provide the 'runat' property of a Control. "Validation (ASP.Net): Element 'asp:Button' is missing required attribute

Create custom FrameworkContentElement to add diagonal line over text in WPF

泄露秘密 提交于 2019-12-10 03:49:11
问题 Is there any way to create a custom FrameworkContentElement (or an Inline ) that draws a diagonal line over its content? Something like Strike-through decoration but with a diagonal shape: It is not possible to inherent from TextDecoration or TextEffect (they are sealed). Any idea? 回答1: UPDATE : I tried to create an example as minimal as possible. In more complex scenarios you will have to extend this. Here is how it looks: this is the corresponding xaml: <AdornerDecorator> <StackPanel>

WPF Custom TabItem - Controls not displayed in Visual Studio Designer

心已入冬 提交于 2019-12-10 03:07:10
问题 I created a custom TabItem with a DockPanel and a Button in it. XAML: <TabItem xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="MovieDB.UI.UserControlls.SearchTab" d:DesignWidth="500.038" d:DesignHeight="309.055"> <DockPanel Background="#FFE5E5E5"> <Button x:Name=

Android: How to use NumberPickerDialog

南笙酒味 提交于 2019-12-10 00:25:43
问题 Could someone give me an example of how to instantiate a NumberPickerDialog within Activity.onCreateDialog ?(https://github.com/novak/numberpicker/blob/master/lib/src/com/michaelnovakjr/numberpicker/NumberPickerDialog.java) ? There are examples in a repo called numberpicker-demo for using the widget, but none for the actual dialog. Amongst other approaches I've tried tried something like: return new NumberPickerDialog.Builder(this) .setTitle("Choose Number") .etc.. But this just shows a

Radio Button not firing itemcommand event in repeater

断了今生、忘了曾经 提交于 2019-12-09 23:45:27
问题 I am working on the asp.net custom control in which I am using repeater control to show radio buttons . I need to fire repeaters ItemCommand event when RadioButton is click. The problem I faced is RadioButton is not capabel of firing ItemCommend event and it does not have CommendArgument , and CommandName properties. To accomplish I created asp.net server control , drived i from RadioButton and add CommendArgument , and CommandName properties in it. I also added a Button in it so that I can

WPF Validation ErrorTemplate for Custom TextBox

女生的网名这么多〃 提交于 2019-12-09 17:21:38
问题 Branching off of this question - When attaching a validation error template to my custom textbox like this - <local:CustomTextBox CustomText="{Binding ViewModelProperty}" Validation.ErrorTemplate="{StaticResource errorTemplate}"/> <ControlTemplate x:Key="errorTemplate"> <DockPanel> <Border BorderBrush="Red" BorderThickness="1"> <AdornedElementPlaceholder x:Name="controlWithError"/> </Border> <TextBlock Foreground="Red" FontSize="20" FontFamily="Segoe UI" Margin="3,0,0,0" MouseDown=

Can't use onDismiss() when using custom dialogs - Android

三世轮回 提交于 2019-12-09 15:29:14
问题 I'm working on a little program, and I need to add a custom dialog that passes some info to the calling acitivity when it closes. I extended the dialog class, and when I try to capture the custom dialog when it closes,using an onDismiss listener, it never reaches it because I used a custom dialog. This is part of my activity - . . . attributes customizeDialog = new attributes(con,position,pick.getLastVisiblePosition()); customizeDialog.show(); (The attributes being the name of the class that

How do I make a control with a child control collection in ASP.Net

送分小仙女□ 提交于 2019-12-09 13:15:49
问题 I'm trying to develop a custom control for asp.net that will have the following markup: <bk:ControlMenu ID="cmTest" runat="server" Width="400px"> <Items> <asp:Textbox> <asp:Checkbox> [ List of controls... ] </Items> </bk:ControlMenu> What kind of property will allow me to do this when I'm developing my control? (The items collection being the part in question). 回答1: You can't have nested elements in a standard Web User Control. You'll need to develop a custom server control to achieve that.