user-controls

Use binding to change usercontrol in a grid

淺唱寂寞╮ 提交于 2019-12-25 02:35:10
问题 I'm creating a WPF application, which has a main screen in which other screens are loaded. The main screen can be seen as a header/footer template where the central part is replaced depending on what I need to show at that moment. (It's a 3 row grid where the usercontrol should be put in row 1). This has a viewmodel that is changing header/footer status. I have implemented those changing parts (row 1) as usercontrols. Now I am wondering if there is any way to use binding (to something..) so

How to create new components in Visual Studio 2010

你离开我真会死。 提交于 2019-12-25 02:19:11
问题 Can you tell me how to create new visual component for .net 4.0 in Visual Studio 2010, i have a book about component creation in Russian Language ( Pavel Agurov -Razrabotka Komponentov v MS Visual Studio 2005/2008 ), but methods in this book covers VS 2005 and 2008. And methods gives some errors in VS 2010. EDIT: There is my code public partial class exComboBox : ComboBox { /*public exComboBox() { InitializeComponent(); }*/ private System.Collections.Specialized.StringCollection _itemValues =

Subscription to RenderTransform.Changed will be lost when it does not fulfill the XAML pattern of the designer on initial time

我们两清 提交于 2019-12-25 02:08:19
问题 In my user control I want to get aware of rotations & co. made in the WPF designer. So in my user control I did: private void Test_Loaded(object sender, RoutedEventArgs e) { this.RenderTransform.Changed += this.RenderTransform_Changed; } private void RenderTransform_Changed(object sender, EventArgs e) { // do anything } It seems this.RenderTransform is never null . However unless my user control has the exact XAML structure like the designer makes when i.e. rotating my control, it will fail.

How to Trigger Click Event in WPF User control (Textbox with Button)?

早过忘川 提交于 2019-12-25 01:46:56
问题 I have Created one User control for WPF Like Windows 8 Password box Model. My UserControl XAML Code - <Grid.Resources> <Style x:Key="ButtonWithoutHover" TargetType="Button"> <Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="Margin" Value="0"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border Name="border" BorderThickness="0" Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center"

Can you render a (old) asp.net usercontrol in a asp.net mvc 3 website?

蓝咒 提交于 2019-12-25 01:19:51
问题 I was wondering if there is a way to render (non mvc) asp.net usercontrols in a asp.net mvc website. I have googled it and i am experimenting with it, but haven't found a clear answer (yet). Any1 has a clear answer on this? 回答1: You can render them but if they rely on viewstate and postback, they won't work. 来源: https://stackoverflow.com/questions/9191700/can-you-render-a-old-asp-net-usercontrol-in-a-asp-net-mvc-3-website

Execute a method on second control from the first control in WPF

早过忘川 提交于 2019-12-25 01:16:26
问题 My ViewControl has a method called ZoomIn() . How can I execute this method on this ViewControl by clicking Button control without going to code-behind. <controls:ViewControl/> <Button Content="Zoom In"/> ViewControl.xaml.cs: public void ZoomIn() { double actualWidth = m_child.ActualWidth; double actualHeight = m_child.ActualHeight; double x = (0.5 * actualWidth - Dx) / Scale; double y = (0.5 * actualHeight - Dy) / Scale; float startScale = Scale; Scale = Math.Min(Scale * ZoomFactor, ZoomMax)

RoutedCommand in UserControl is not working as expected

耗尽温柔 提交于 2019-12-25 01:13:54
问题 I am trying to use RoutedCommands in my UserControls inspired by this article from Josh Smith. https://joshsmithonwpf.wordpress.com/2008/03/18/understanding-routed-commands/ I did it a bit different from the example in the article and defined the RoutedCommand and CommandBindings in the Usercontrol. Now I am trying to use it my MainWindow. So that by clicking the Button, the Command in UserControl is executed. Unfortunately what I get is a disabled button. The Foo_CanExecute() method is never

Bind custom control property with ListBox.Items

守給你的承諾、 提交于 2019-12-25 00:17:34
问题 My custom control has the following basic structure: public class NewTextBox : TextBox { public ItemCollection Items { get; set; } } And in XAML I have: <ListBox Name="listBox1" /> <my:NewTextBox Items="{Binding Path=listBox1.Items}" /> The bind doesn't work in this case. Is the property Items wrong? 回答1: Your binding is incorrectly. Use the ElementName property in your binding to tell WPF where to look for the data, then bind to the Items property <my:NewTextBox Items="{Binding ElementName

Need to reference Usercontrol(ascx) in ASPX page in more than one place with different results

百般思念 提交于 2019-12-24 23:59:17
问题 Scenario : Default.aspx is as below. <%@ Page MasterPageFile="~/StandardLayout.master" Language="C#" CodeFile="Default.aspx.cs" Inherits="_Default" %> <%@ Register src= "~/Controls/Us.ascx" tagname="AboutUs" tagprefix="site" %> <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server"> <div id="large"> <site:AboutUs ID="AboutUsControl" runat="server" /> </div> <div id="small"> <site:AboutUs ID="AboutUsControl" runat="server" /> </div> </asp:Content> AboutUs.ascx.cs assigns

How do I control multiple user controls with one button in Windows form?

烈酒焚心 提交于 2019-12-24 23:50:31
问题 I have a form that will dynamically create user controls, and each of those user controls has a start button and a stop button. Is there a way to have a start all and stop all button on the form? I tried having a Boolean that gets set true when the main form button is clicked, but once the user control is created it does not check the Boolean value. Here is the code for the main form (vdoPlayer is the user control): namespace AutoPopulateVideoSaving { public partial class Form1 : Form {