user-controls

WPF: Converting from UserControl to CustomControl

筅森魡賤 提交于 2020-01-01 19:15:41
问题 I have a WPF UserControl - SegmentConrol , that represents a line with some text and an array displaying the direction (>). As I have to customize this control styles, I decided to switch to a CustomControl, because I read this is better in a way... Now, I have some "troubles" to switch from UC to CC. Particularly, no idea where to put the <UserControl.Resources> part. If any of experts could advise me they are welcomed. Here is my UserControl: <UserControl x:Class="MyNamespace

WPF UserControl inheriting another UserControl

不羁岁月 提交于 2020-01-01 18:18:11
问题 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() { } } } And code doesn't give any error thus far. But when I inherit it in a new usercontrol: namespace DMS.Presentation {

Add a UserControl in/over titlebar in Window

十年热恋 提交于 2020-01-01 16:46:11
问题 In WPF, I want to add a userControl in/over titlebar in Window, like this: The Red part is that UserControl, and the Green part is titlebar. Now I hope to get some suggestions from you. Need to extend the Window class or just customize the style of the Window? It's better to provide source code. 回答1: You can do this by implementing your own title bar. In order to do so set your window style to none: WindowStyle="None" This will mean that the window will have no control box (minimize, maximize

Dynamically add a usercontrol in VB.net

非 Y 不嫁゛ 提交于 2020-01-01 11:52:50
问题 I have made a custom UserControl i Vb.net (windows application). How can I add this dynamically to a form? 回答1: A UserControl is essentially just another class. It inherits from Control, so you can do all kinds of things you do with controls, but otherwise it's just a class. Thus, to add the usercontrol dynamically to your form you'd do the following: Create a new instance of your control. Like Dim X As New MyControl() Add the control to your form as a child object to whatever container you

Dynamically add a usercontrol in VB.net

痴心易碎 提交于 2020-01-01 11:52:08
问题 I have made a custom UserControl i Vb.net (windows application). How can I add this dynamically to a form? 回答1: A UserControl is essentially just another class. It inherits from Control, so you can do all kinds of things you do with controls, but otherwise it's just a class. Thus, to add the usercontrol dynamically to your form you'd do the following: Create a new instance of your control. Like Dim X As New MyControl() Add the control to your form as a child object to whatever container you

DoEvents, Waiting, and Editing

折月煮酒 提交于 2020-01-01 10:58:31
问题 I have a set of code that contains: Application.Wait (Now + TimeValue("4:00:00")) This is essentially pausing the macro for a four hour window from 3 AM (when it finishs running the code) till 7 AM (when it should resume). The code is on an endless loop essentially. I want the user to be able to have control during that time to edit certain cells. I have tried DoEvents but have not found the way to keep the macro running, yet provide control to the user during that time when the macro is

Setting tab order in wpf when use from UserControls?

我只是一个虾纸丫 提交于 2020-01-01 05:21:07
问题 I have a User Control like this: <UserControl x:Class="MySample.customtextbox" 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" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="20" d:DesignWidth="300"> <Grid> <TextBox x:Name="Ytextbox" Background="Yellow"/> </Grid> And I use this control in a window and set

Visual Studio adds a circular reference when I drag and drop a user control from the Toolbox

隐身守侯 提交于 2020-01-01 02:44:10
问题 I have a user control C that is defined inside project P. C is present as a ".NET Framework Component" in my Visual Studio Toolbox. I open a form F (also defined inside project P) and drop C onto F. Once I do that drop, Visual Studio adds a reference under P pointing to P's own DLL . This is unnecessary and causes tons of build errors like The call is ambiguous between the following methods or properties... after which it lists the exact same method twice. If I go into References and delete

Binding to UserControl DependencyProperty

≯℡__Kan透↙ 提交于 2020-01-01 02:17:08
问题 I have created a UserControl with some DependencyProperties (in the example here only one string property). When I instantiate the Usercontrol, I can set the property of the UserControl and it is shown as expected. When I am trying to replace the static text by Binding, nothing is displayed. My UserControl looks as follows: <User Control x:Class="TestUserControBinding.MyUserControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx

Binding Silverlight UserControl custom properties to its' elements

耗尽温柔 提交于 2019-12-31 19:44:07
问题 I'm trying to make a simple crossword puzzle game in Silverlight 2.0. I'm working on a UserControl-ish component that represents a square in the puzzle. I'm having trouble with binding up my UserControl's properties with its' elements. I've finally (sort of) got it working (may be helpful to some - it took me a few long hours), but wanted to make it more 'elegant'. I've imagined it should have a compartment for the content and a label (in the upper right corner) that optionally contains its'