FAQ Database Discussion Community


Custom Control BorderThickness

c#,wpf,textbox,user-controls,border
I've created a custom WPF user control. The problem is, that sometimes I need a BorderThickness of 0 and sometimes a BorderThickness of 1. <UserControl ...> <clay:TextBox x:Name="ClayTextBox" BorderThickness="1" > </clay:TextBox> </UserControl> If I'm using the control in a xaml document like this: <clay:TextBox x:Name="ClayTextBox" BorderThickness="0" > </clay:TextBox> ... the...

asp:dropdownlist in my usercontrol wont postback onselectedindexchanged

c#,asp.net,user-controls,updatepanel,postback
I cannot get the asp:dropdown list in my usercontrol to postback to update the number of days. The usercontrol: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Profile.ascx.cs" Inherits="TestApp2.Views.Profile" %> <asp:UpdatePanel ID="ProfileMainUpdatePanel" runat="server"> <ContentTemplate> <div class="form-group profile-form"> <asp:DropDownList runat="server" id="selYear" class="form-control profile-date right-align" OnSelectedIndexChanged="selYear_SelectedIndexChanged" />...

How to initialize user control sub controls when late binding

vb.net,winforms,user-controls,late-binding
I have a usercontrol with a webbrowser control on it compiled out to it's own assembly. This control worked in my project prior to breaking it out to its own assembly. Now the goal of doing this is to late bind to the assembly, instantiate the control, and add it...

how to run a program under different user's accounts

user-controls,window
my program (C:\Program Files\MyApp\Myprog) starts with windows startup; at device insertion Myprog.exe invokes another program (C:\Windows\comp.exe). this process works fine in the admin account in which I install the program but Myprog.exe is unable to invoke comp.exe when users account is changed. I want (C:\Windows\comp.exe) to be invoke in each...

Dependency Property UserControl Binding not working

c#,wpf,xaml,mvvm,user-controls
My project is implemented in MVVM. I have a MainWindow, which consists of a statusbar and a tabview. Inside the tabview, there is a UserControl called "AnnotationView". Annotationview is the parent of two smaller usercontrols, called TimePicker. TimePicker consists of two textboxes, one for hours and one for minutes. I...

c# dispose UserControl Thread

c#,multithreading,user-controls,dispose
I have a MainForm with a UserControl. In can chose which usercontrol I want the show in my MainForm. Everytime I change my usercontrol, I dispose it. private void buttonBar1_ItemClick(object sender, Janus.Windows.ButtonBar.ItemEventArgs e) { foreach (Control control in panelMain.Controls) { control.Dispose(); } panelMain.Controls.Clear(); //... MyUserControl uc = new MyUserControl(); MyUserControl.Dock...

ICommand Dependency Property

c#,wpf,mvvm,user-controls,icommand
I have an UserControl with a button inside. This button needs to add some items to a Grid that's inside said UC. I'm aware I can do this with a Click event. The issue here is I am using MVVM and altering data outside their corresponding ViewModel would break the...

Removing Items from Gridview and refreshing the gridview without redirecting to the same Page.(Windows Phone 8.1 Xaml)

gridview,user-controls,windows-phone-8.1,itemtemplate,flyout
I have a gridview with a Usercontrol as its itemtemplate. In the Usercontrol I have a flyout attached to it using which the user can choose to delete the entry. After deletion how do I remove the entry/Update the gridview without redirecting to the samePage and removing the backstack entry?...

VB NET. How fire an event when other event is fired?

vb.net,events,user-controls,event-handling
Best regards. I'm here, developing in VisualBasic.Net again. I create a UserControl who can create buttons in execution time and I need a way to execute a function in the Form where I use the UserControl every time I click one of the buttons. I was thinking handdle my function...

How to attach an eventhandler from a customcontrol to its parent usercontrol close event?

wpf,user-controls,custom-controls
I have been unable to find an answer to this. I have a long series of usercontrols, each creating one or more usercontrol children. The last usercontrol in the series creates a custom control that uses unmanaged code. I need the custom control to be made aware of the user...

Only fire the event on the correct User Control

c#,events,user-controls
I have the following Scenario, I have a TabControl where each TabPage represents a Year. On every Year-TabPage I have another TabControl with 12 TabPages which are the Months. On every Month-TabPage I have a UserControl. I do that like this: foreach (TabPage tp2 in tbMonat.TabPages) { ucMonat Monat =...

designing “pretty” user controls [duplicate]

c#,wpf,design,charts,user-controls
This question already has an answer here: Creating a WPF Custom Control 2 answers I would like to create a user control which represents a pie chart and offers some mouse-over (tooltips / highlighting) and on-click events for the different parts of the chart. However since i can not...

Best Way to Replace UserControl Loaded in TabControl TabItem

wpf,xaml,user-controls,tabcontrol,tabitem
I currently have a TabControl loaded in MainWindow.xaml, which has three tabs. Let's name them Tab1, Tab2 and Tab3. The individual tabs have views (usercontrols) supplied and they all work as expected. Code as follows. I am using MahApps Metro TabControl here. <Controls:MetroAnimatedSingleRowTabControl Grid.Row="0" Grid.ColumnSpan="4" x:Name="MainTabControl"> <TabItem Header="Tab1"> <view:Tab1View DataContext="{Binding}"...

How to bind my UserControl to an AvalonDock

c#,wpf,user-controls
please I am getting out of my mind trying to understand something, I really need some direction, because I am lost. I have a UserControl I created called TerminalControl which have a view which wraps a TextBox bounded to a Text property in the view model, which is updated in...

Form controls not showing

c#,forms,winforms,user-interface,user-controls
I'm making a console application that shows a form. I created the form from scratch. When I run the program, the form shows, but the controls I added don't show. My code: using System; using System.Windows.Forms; using System.Drawing; namespace form { public class main { public static void Main() {...

Stripe Payment on user behalf

ruby-on-rails,user-controls,payment-gateway,stripe-payments,stripe-connect
I am using Stripe for payments. I want to transfer funds to other Stripe users. My account is not in USA. begin Stripe::Charge.create( :amount => amount_in_cents(amount), :currency => DEFAULT_CURRENCY, :customer => client.payment_token, :description => session_or_purchase.payment_description ) rescue Stripe::CardError, Stripe::InvalidRequestError, Stripe::APIConnectionError, Stripe::StripeError => e body = e.json_body err = body[:error] return...

Using multiple images to create a scalable control

c#,xaml,user-controls,background-image,scalable
Problem I needed to make controls that used images as backgrounds that could be any width without distorting the images. For example if I used a single image and stretched it the rounded corners of the image would become distorted. Solution The solution, given by Noxivs, was to use a...

WinAPI multiple controls issue

function,winapi,user-controls
I'm trying to create a window holding a button control and an edit control. I create the controls using two functions, one for the button control and one for the edit control. The problem I get is that I can't have both controls on the window at the same time....

data binding with a button with user control

c#,wpf,data-binding,user-controls
I'm having problems binding a user control. I have a main window, which with a press of a button gets my value. However when i use my user control in the main window i cant set the text box to add my value. Instead of 'text' i want my user...

show and hide UserControls based on button click

c#,wpf,user-controls
I have 3 UserControls and my MainWindow. In my UserControl3 I have two buttons (button1 & button2). I need to add the UserControl3 to my MainWindow when we start the application If I click button1, usercontrol1 should appear on my mainwindow, if i click button2, usercontrol2 should appear on my...

How do I capture MouseWheel events in a UserControl?

.net,winforms,scroll,user-controls
I have a UserControl derived control. When the user moves the mouse wheel I'd like to capture that and respond to it. I've tried using the Scroll event but that doesn't ever seem to fire which I'm guessing is because my control doesn't have (or need) a scroll bar. I...

Casting a TabItem to UserControl in WPF

c#,wpf,casting,tabs,user-controls
I have a Tab Control on my main screen. It has different tab items. For example: <TabControl Name="mainTab" Padding="0" Margin="70,80,350,49"> <!--Left,Top,Right, Bottom--> <TabItem GotFocus="TabItem_Animals_GotFocus"> <TabItem.Header> Animals </TabItem.Header> <ContentControl Margin="10"> <Frame Name="animalFrame" Source="AnimalWorkSpaceView.xaml"></Frame> </ContentControl> </TabItem> <TabItem GotFocus="TabItem_Calfs_GotFocus"> <TabItem.Header> Calfs...

WPF Caliburn Micro: Exchanging UserControls in a Window dynamically using ContentControl

wpf,user-controls,caliburn.micro,contentcontrol
This question is related to Add a usercontrol to caliburm micro dynamically. I have read any other related threads before open this new thread, but I still don't understand and find no solution. Please accept my apology if some of you take this as duplicate. I have a window (MainView)...

WPF Usercontrol XAML Triggers not working

c#,wpf,xaml,user-controls,event-triggers
I am making an UserControl with XAML which is a simple border with a Dock Panel inside it. And inside the Dock there is an image and text bellow as properties ( i got that all figured out already). However i need the Border that contains everything to change color...

Changing custom child property doesn't update parent class's control

.net,vb.net,user-controls,typeconverter
I don't know what I'm doing wrong, but I've created a custom control with a property that features subproperties using a type converter that inherits ExpandableObjectConverter. It seems like I've got everything set up correctly, but when I try to change any of the subproperties of the parent property, the...

Accessing user controls from a separate application but within same application pool

c#,asp.net,.net,user-controls
I'm attempting to create a form page that involves the use of some user controls, and the Item.aspx file contains this line: <%@ Register Src="~/project/path/X.ascx" TagName="X" TagPrefix="uc" %> but somehow I keep getting the following warnings when I try to build my application: Element 'X' is not a known element....

UserControl passes click event to MainWindow Twice

wpf,vb.net,events,user-controls
I have finally gotten my UserControl to do everything I need, generating a button with an icon and text, but when I try to pass the click event up to my Main Window, I find it fires twice! In the abbreviated code below, my test MessageBox comes up twice in...

How can I create a dockable window in WPF (C#)?

c#,wpf,xaml,user-controls,window
Let's say you have a view (userControl) with its own XAML code, and another window (window) also with its own XAML code. Is there any way to be able to dock this window into the view (the view will rearrange the UI to accomodate the docked window), but also get...

Entity Framework 6 and Custom Controls

.net,entity-framework,user-controls
I'm creating a custom user control that will eventually be used in multiple projects. It's going to be a fat control that contains a lot of business logic and accesses the SQL database to load data and validate user actions. (One of my requirements is to make it as simple...

How to get/update property of parent object from child object

c#,oop,user-controls
I have a class called Invoice public Invoice() { this.ServiceId = 0; this.Sections = new List<Section>(); } I have another class called Sections public Section() { this.Items = new List<Item>(); } and yet another class called Item public Item() { blah, blah; } Now I am passing an object of...

UserControl hidden, Zindex misused?

c#,xaml,user-controls,visibility
In my main page I try to show a list of stuff, and on this stuff a userControl as an overlay. In fact I never see it. (In the design view, my userControl is oaky) XAML MainPage <Grid> <Grid x:name="MyPage"> <!-- All this part is visible --> //Button //Button //nice...

how can i access control in user control from master page?

asp.net,user-controls,master-pages
I have a label in user control and i want to access this control from master page. I do not use <%@ Register TagPrefix="..." TagName="..." Src=".." %> for user control in head of master page. How can i access this control? Thanks a lot. Edit: I am trying to create...

After Creating a Control, automatically add it to specific panel

c#,winforms,user-controls,event-handling
I have UserControls that are "Buttons" for Menu purposes. Those Buttons shall automatically add to the right Panel. So basically, if I write: MenueButton button1 = new MenueButton(); the button shall automatically be added to MenuePanel on GUI Form. (Maybe Some easy action handler?) Is there a way to achieve...

WPF - ContentPresenter does not bind to UserControl Content

c#,wpf,xaml,user-controls,blend
Ok, so I'm relatively new to WPF and I'm having a bit of a problem with my usercontrol which contains a custom button. Everything was working fine until I tried binding the content of the custom button to the usercontrol content. UserControl Code: <UserControl 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" xmlns:local="clr-namespace:OP"...

Binding Property at runtime

c#,wpf,xaml,datagrid,user-controls
I have created an UserControl for reusability in my program: GroupPanel.xaml: <UserControl x:Class="View.UserControls.GroupPanel" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"assembly=ViewModel" Name="root"> <DockPanel> <DataGrid DockPanel.Dock="Top" AutoGenerateColumns="False" CanUserAddRows="True" CanUserDeleteRows="False" CanUserReorderColumns="False" DataContext="{Binding ElementName=root}" ItemsSource="{Binding...

How to expose internal control's property to its parent UserControl in WPF

wpf,xaml,properties,user-controls
I have a DialogPrompt UserControl that will have an Image and a TextBlock. Here is the template: <UserControl> <Button x:Name="_OkButton" Content="OK"/> <DockPanel > <Image/> <TextBlock x:Name="_DialogTextBox" /> </DockPanel> </UserControl> How do I expose Source property of the Image and Text property of the TextBlock inside my UserControl?...

Find property of sub child usercontrol in aspx page

asp.net,user-controls
There is a User Control - ChildUC.ascx with Property "FirstName" ChildUC.ascx <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ChildUC.ascx.cs" Inherits="SampleDevExpress14._2.UserControls.ChildUC" %> <asp:TextBox runat="server" ID="txtName"></asp:TextBox> <asp:Button runat="server" ID="btnClick" Text="Click" OnClick="btnClick_Click"/> ChildUC.ascx.cs - This got a property FirstName public partial class ChildUC : System.Web.UI.UserControl { public string FirstName { get; set; } } This ChildUC.ascx...

Define Blend Expression ViewModel definition for RelativeSource binding

wpf,xaml,mvvm,user-controls,blend
I have an UserControl (MyCompositeView) where I add some other UserControls (MyDetailView). To get intellisense and refactoring ability I add to the CompositeView the d:DataContext in xaml. To Manipulate the UserControl while adding them an new DataContext I bind the Visiblity to the RelativeSource (my CompositeViewModel). Unfortunately the matching against...

How to create user control for displaying collection of other user controls in WinForms?

c#,winforms,user-controls
I need to create a user control MyTypeListControl to display collection of objects of type MyType using a user controls MyTypeDisplayControl instance for each of those objects. So that I could add instance of MyTypeListControl to my WinForm, then load collection of MyType and assign it to MyTypeListControl's DataSource. In...

Wpf UserControl with its own data context and external dependency property

wpf,vb.net,user-controls,media-player
I'm trying to create a simple AudioPlayer control multiple reuse in a solution I'm working on. I have seen numerous example in various posts and blogs around the net and from those have created a small control with four buttons. The xaml is defined thus: <UserControl x:Class="AudioPlayer" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"...

User Control code behind is not called when published on server

c#,asp.net,user-controls,telerik
I have a simple user control which is basically a contact form and consists of three text boxes, 1 button and 1 label. I am also using Telerik RadAjaxLoadingPanel and RadAjaxPanel. The markup of the user control is given below, <telerik:RadAjaxLoadingPanel ID="RALP_ContactForm" runat="server" Transparency="5"> <div class="border" style="display: table; height: 240px;...

Asp.net web form user control with ClientIdMode = “static” cannot be accessed in javascript

asp.net,webforms,user-controls
I have a user control that is used inside an ASP.Net web form page. In the user control I have set the ClientIdMode = "static" e.g <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="QuestionUserControl.ascx.cs" Inherits="Kids.Math.Presentation.UserControls.QuestionUserControl" ClientIDMode="Static" %> In the form that I am using it I also set Id as: <uc2:QuestionUserControl runat="server" ID="QuestionUserControl1"...

Design Layout differs from Runtime Layout

c#,wpf,user-controls
I have a Project, where I am using prism for Navigation between usercontrols. The App.xaml has some Definition for resources: <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/Resources/GlobalResources.xaml" /> <ResourceDictionary Source="pack://application:,,,/Resources/Themes/Generic.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> These are...

How to bind multiple properties in a UserControl

c#,wpf,xaml,binding,user-controls
Let's say we have a UserControl like this: <UserControl x:Class="...> <StackPanel> <TextBlock Name="TextBlock1" /> <TextBlock Name="TextBlock2" /> <TextBlock Name="TextBlock3" /> ... <TextBlock Name="TextBlock10" /> </StackPanel> </UserControl> And we have properties defined like this: public string Text1 { get; set; } public string Text2 { get; set; } public string Text3...

Trouble with configuring users and connecting to Mongo with PHP

php,mongodb,user-controls
I installed mongo 3.0.0 on my ubuntu server. I tried to use PHP (with appropriate lib installed) to connect to mongo to learn sth new. Unfortunaltey I cannot go any further. My user configuration looks like this: > use testdb switched to db testdb > show users { "_id" :...

Bind DataGrid.Columns collection to ancestor in custom WPF UserControl

c#,wpf,xaml,datagrid,user-controls
DI'm trying to expose the DataGrid.Columns property to the Ancestor UserControl like I did with the items source using the answer here. There doens't seem to be any properties available for me to bind the DataColumns in the following fashion: <PagedDataGrid> <PagedDataGrid.Columns> <DataGridTextColumn Header="Custom Column"/> <PagedDataGrid.Columns> </PagedDataGrid> Here's what I...

ViewBox default width and height

wpf,user-controls,viewbox
i've created usercontrol with viewbox as a main container. If i add this usercontrol to a window it will place all area of it. How to set up default width and height for the control? <UserControl> ... <Viewbox> <Grid Height="167" Width="178"> <ed:RegularPolygon Fill="#FFF4F4F5" InnerRadius="1" PointCount="3" Stroke="Black" RenderTransformOrigin="0.5,0.5" Margin="-39,52,69,52" > <ed:RegularPolygon.RenderTransform>...

How to highlight active row in excel and then return to base background color in VBA

excel-vba,user-controls,imacros
How do you highlight an active row in excel in VBA. and then when another row is selected, return that row to base background color, and highlight the new row. Also how to clear all rows highlighted, using a clear button on the user form. so there are tow question...

Usercontrol derived from abstract class

c#,winforms,user-controls
i am building a dynamic Winforms UI based on 12 Usercontrols which are selectable by a combobox and are derived from an abstract class (to provide a unified api). Initiating all of them takes about 800ms (much too slow and useless because only one will be used after selection). But...

How to bind to a property of a UserControl in WPF?

wpf,mvvm,data-binding,user-controls,dependency-properties
I'm trying to bind to a property of a user control, but it doesn't seem to work. <Controls:BasicFilter Title="Some title" FilterLists="{Binding LocationFilterLists}"/> FilterLists is the property I'm trying to bind to. Title property contains a text which is shown on a label within my control and this works well. I've...

Load all user controls of a form on start

c#,winforms,events,user-controls
My Winform application has a main form with a tab control. In each tab there is a User Control. And each user control has Controls (such as DataGridViews, etc) that are loaded on the Load event of the user control. The problem I have is that I would like to...

WPF UserControl does not show

c#,wpf,xaml,mvvm,user-controls
Have been trying for a few hours to understand why my UserControl isnt showing up. It works in the designer, and works if i just make one locally: <local:CurrentlySelectedServerUserControl Grid.Row="1" /> Next, I created a DataTemplate for the ViewModel which I wish to display. This ViewModel is the DataContext of...

access the user control property at clinet side

asp.net,properties,user-controls
I have a User Control - FilterPanel.ascx which is used twice on QuickSearch.aspx <dx:ASPxRoundPanel ID="filterPanel" ClientInstanceName="filterPanel" runat="server" ShowCollapseButton="True" CssClass="contentPanel" CornerRadius="0"> <ContentPaddings Padding="0px" /> <HeaderStyle CssClass="contentPanelHeader" ImageSpacing="0px" ForeColor="#FFFFFF" BackColor="#5A81B3" /> <PanelCollection> <dx:PanelContent> <dx:ASPxTextBox runat="server" ID="txtdxKeyword" Width="139px" Height="18px" Visible="True"...

Dynamic editing Content

c#,wpf,mvvm,user-controls,observablecollection
I have a MVVM application using 3 usercontrols as content in multiple pages (pages are also usercontrols) with some additional static content. For example: Page1.xaml <StackPanel x:Name="pnlMain" Orientation="Vertical"> <TextBlock FontWeight="Bold" Text="Title 1" /> <local:UserControl1 /> <TextBlock FontWeight="Bold" Text="Title 2" /> <local:UserControl2 /> <local:UserControl2 /> </StackPanel> Page2.xaml <StackPanel x:Name="pnlMain" Orientation="Vertical"> <TextBlock...

Do not show image when use User Control In Asp.net

asp.net,user-controls
I have a user control in my project (asp.net) that have an image. It has below code: <%@ Control Language="C#" ClassName="Header" %> <asp:Panel ID="Panel1" runat="server"> <img alt="The Night Owl" src="../Images/bookshelf.jpg" width="800" height="110"/> </asp:Panel> <asp:Panel id="menuPanel" runat="server"> <a href="../Default.aspx">Home</a> | <a href="../Titles.aspx">Titles</a> | <a href="../Authors.aspx">Authors</a> | <a href="../Publishers.aspx">Publishers</a>...

xml, my.settings? Which way to go?

xml,vb.net,dynamic,user-controls,savestate
After searching almost 3 days on the web I decided to post on here because I can't seem to find it on my own. My skills in Visual Basic are quite limited but I am learning. My goal is to write a program that is able to analyse tests kids...

How to set a WPF usercontrol property from XAML?

c#,wpf,xaml,user-controls
I'm trying to set the fill property of several instances of the same usercontrol from XAML in order to distinguish them. I'm using a dependency property in the C# codebehind of the control and referring to that in the XAML when I instantiate the control. Here's a simplified example of...

WPF UserControl exposing properties of subcontrols for binding

c#,wpf,xaml,binding,user-controls
I'm working on developing a custom user control for my application. This control is very simple. It's just a grid, with a checkbox in [0,0] and a TextBlock in [0,1]. I've had no issues getting it designed how I'd like in XAML. However, the second step is giving me some...

getting values in R from tkentry() widgets

r,user-controls,widget,tcl,tk
I'm trying to create a small interactive window in which user (for now me) can enter specific information regarding power calculations (test name, number of groups, type of data) in order to perform the correct kind of power calculation. I know how to do this directly in R, but I...

What are techniques in ASP for communication from usercontrol to parent page?

c#,asp.net,events,user-controls,asp.net-ajax
I have having some trouble with communication from a usercontrol to the main page. The order in which events are raised means that the action on the user control occurs too late in the post back to have an effect on the main page. For example, I have a button...

Use XAML UserControl with dataobject as property , as DataTemplate in Gridview - Binding

xaml,listview,binding,user-controls,data-objects
I have a collection of Objects with dependencyproperties, and Observer patern as I feed realtime data in "AssetIHM" Object. public class assetVM: DependencyObject ,IObserver { public assetVM(AssetIHM aihm) { ObserverCollectionSingleton.ObserverCollectionInstance.Add(this); _aihm = aihm; } private string _assetname; public string assetname { get { return _assetname; } set { _assetname =...

How to parametrize datasource in the user control based on ASPxGridView?

asp.net,gridview,user-controls,devexpress,datasource
Summary: The same user control displays notes at different levels of ASPxGridView nesting. How to parametrize the user control? Details: I want to display a ASPxGridView for Projects. Each DetailRow for the project displays the nested ASPxGridView with Milestones and another ASPxGridView Notes at the same level (inside the same...

WPF Control Disposal

c#,wpf,user-controls,dispose,disposal
In WinForms, for all controls there is the .OnDisposed override, the Disposed event, and the IsDisposed property. WPF seems to have no equivalent. How can I listen for the disposal of a UserControl in a WPF application? To be more clear; I need to know when the control is removed....

How to remove Validation Display Error box shown on top in wpf?

wpf,validation,user-controls
In my wpf user control, I have a text box with an error validation box. and it works fine. but when I reduce screen size, the error box comes top to next panel aside the text box, when the text box and other controls go down of the panel. How...

DataContext scope during binding

wpf,data-binding,user-controls,scope
I have a View A that has a UserControl U containing its own UserControl UChild. When I set the DataContext of A, will UChild get the DataContext of A using direct binding to its grandparent's property i.e. { Binding PropertyFromA } within UChild? I am trying to achieve this but...

WPF use one ViewModel for multiple UserControls

wpf,binding,user-controls,viewmodel,datacontext
I've searched a lot for an answer for this question, but couldn't quite find an answer. I have my main Window and 4 different UserControls. The Window is constructed from all 4 UserControls. I have a class which is the Window's ViewModel. I wish to set the DataContext of the...

In ASP.NET Webforms how to run JavaScript when adding a UserControl to a page

javascript,c#,jquery,asp.net,user-controls
I have a UserControl with many fields on it. In the ascx I have a document.ready() function where I hide some of the fields with JQuery. On a regular page when the page is loaded the fields are hidden and the JavaScript works. Lets say when the user clicks a...

How to create moveable (by mouse) buttons at runtime c#

winforms,user-controls,runtime
I am using the following code to create buttons at run-time but how to make them movable (drag-able with mouse on screen anywhere) var b = new Button(); b.Text = "My Button"; b.Name= "button"; b.Click += new EventHandler(b_Click); b.MouseUp += new MouseEventHandler(this.b_MouseUp); b.MouseDown += new MouseEventHandler(this.b_MouseDown); b.MouseMove += new MouseEventHandler(this.b_MouseMove);...

Placing a User Control into a groupbox

c#,winforms,user-controls
I have tried to search this question but most of the questions I've seen deal with how to place a user control into a group box in winforms. I have a slightly different question. I have a form that contains a combo box and group box. I have a series...

Listbox itemsource as User control

c#,wpf,binding,user-controls,listbox
I have a user control which has few controls. <UserControl> <Grid> <Expander Header="{Binding Path=Headerval}"> <StackPanel Margin="10,4,0,0"> <DataGrid x:Name="dataGrid" AutoGenerateColumns="False" ItemsSource="{Binding Path=records}"/> </StackPanel> </Expander> </Grid> </UserControl> I am using this set of user controls as my ItemSource in my ListBox <ListBox x:Name="myListBox" ItemsSource="{Binding Path=_myControl}"> <ListBox.ItemTemplate> <DataTemplate>...

C# Win.Form - graphics disappear after load

c#,winforms,graphics,user-controls,drawing
I'm drawing on a User Control to show the time between two dates. My problem is when the applications starts running or every time I Refresh() the User Control all graphics disappears until the Form is resized. Observing how the Form behaves when it refreshes, the User Control is shown...

How can I create a WPF data grid with an enhanced table header?

c#,wpf,user-controls
I'm currently working on a WPF based data management system, which is planned to replace the old Excel based one. This old system is mainly consist of tables where the user can input his data. One of these tables looks like this: The number of rows and columns are fixed...

Can/Should I create instances of a UserControl in my viewmodel?

c#,wpf,mvvm,user-controls
Question regarding UserControls and MVVM. I have my wpf app with a main View/ViewModel. The viewmodel has a ObservableCollection of my usercontrol(s) that a listbox is bound to. The UserControl instances are added to the collection at run time based on events. My question is if it's within the MVVM...

Display a User Control From Another User Control MVVM

c#,wpf,xaml,mvvm,user-controls
I currently have this method in my view model which is triggered when the user clicks on a grid row: public ICommand EmailPopUpCmd { get; set; } private void EmailPopUp(object sender) { //ToDo: pdf viewer pop up var test = sender; var email = new EmailView { DataContext = new...

How to display a folder of shortcuts into a DataGrid or another control using WPF/c#

c#,wpf,file,c#-4.0,user-controls
I have a folder (X:\Shortcuts) with shortcuts which could have the following extensions LNK, URL, EXE I want to show a grid of the shortcuts (Name and Icon) so the user can select them and they will get copied to H:\Desktop if it exists otherwise %USERPROFILE%\Desktop I don't need help...

WPF UserControl inheriting another UserControl

c#,wpf,user-controls
I am trying to inherit an usercontrol in WPF the way mentioned in How can a WPF UserControl inherit a WPF UserControl? namespace DMS.Presentation { /// <summary> /// Interaction logic for WorkSpaceViewControl /// </summary> public abstract class WorkSpaceViewControl : UserControl { public WorkSpaceViewControl() { InitializeComponent(); } private void InitializeComponent() {...

How to make movable character in maze with C++

c++,user-controls,2d,player,maze
So I have my maze printed out once the user presses 1 in order to launch the map and other variables. I have declared the player as a smiley face or set equal to 1. However, I would like to make this character movable throughout the maze but am having...

How to bind and refresh UserControl binding in WPF?

c#,wpf,mvvm,data-binding,user-controls
I'm trying to do a simple OneWay binding for a user control, but I honestly don't understand why some parts aren't working. To be simple, I created a WPF standard UserControl with some dependency properties. In my main window, I hide/display the UserControl depending of some events, and I bound...

Lambdas in Base Constructor Call

c#,user-controls
Okay, so I have the following base class: public partial class InputValidator<T> : UserControl { public InputValidator(TryParse<T> parserMethod, T initialValue) { } public T Value { get; set; } public bool IsInputValid { get; } public override string Text { get; set; } public string InputInvalidMessage { get; set; }...

Draw checkbox tick according to the box size?

.net,vb.net,winforms,user-controls,gdi+
Introduction I'm writting a simple checkbox user-control that will draw a background and a tick in a custom color. To draw the tick, I do this: ''' <summary> ''' Draws the checkbox tick. ''' </summary> ''' <param name="g">The drawing surface.</param> ''' <param name="rect">The box rectangle.</param> ''' <param name="checkState">The checkbox state.</param>...

How to set “ApplicationID” on LoginButton control? (Facebook SDK .Net)

c#,xaml,user-controls,windows-phone-8.1,facebook-c#-sdk
I'm following the login tutorial on facebooksdk.net to implement their login button user control, but after referencing the library and adding the LoginButton I can't find a ApplicationId property as shown in the tutorial. To debug this, I've searched through the properties available and tried referencing both namespaces, but each...

overlap multiple user controls (div) without using position:absolute

html,css,asp.net,vb.net,user-controls
I already read many scenarios regarding overlapping divs but none is working with me. This is my current UI: and this is my partial aspx code: <table style="width:100%;"> <tr style="width:100%;"> <td style="width:33.33%; vertical-align:top;"><uc1:statform runat="server" ERBedNumber="Bed1" TempHospNum="ER101" id="statform1" /></td> <td style="width:33.33%; vertical-align:top;"><uc1:statform runat="server" ERBedNumber="Bed2" TempHospNum="ER102" id="statform2" /></td> <td style="width:33.33%;...