user-controls

xaml ResourceDictionary inside User Control Library

你离开我真会死。 提交于 2020-02-23 03:43:06
问题 how is it possible to define a ResourceDictionary inside a User Control Library and access them via Xaml-Code. I've created something like this: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" xmlns:Dialog="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro" > <Style x:Key="NormalStyle" TargetType="{x:Type

changing contents of a grid in wpf dynamically

a 夏天 提交于 2020-02-05 06:41:06
问题 I am trying to change the contents of a grid dynamically using usercontrol.My mainWindow.xaml looks like this. <Window x:Class="testapp.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="524" Width="856"> <Grid Background="Black"> <!--<Image Height="44" HorizontalAlignment="Left" Margin="284,0,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="229" Source="/testapp

DataBinding to a UserControl inside of a UserControl [duplicate]

爱⌒轻易说出口 提交于 2020-02-05 04:47:12
问题 This question already has answers here : WPF - Should a user control have its own ViewModel? (5 answers) How to correctly bind to a dependency property of a usercontrol in a MVVM framework (4 answers) Closed 2 years ago . In my project, I need to DataBind to a UserControl that resides in another UserControl. For the sake of brevity, I created a conceptually similar but very simple project. Imagine that I am creating a Phone Book application, with two user controls in it, that looks like below

ASP.NET Client Id's not being generated for loaded control

早过忘川 提交于 2020-02-04 05:43:49
问题 I have a UserControl ('AddressInfoGroup') within an updatepanel that dynamically loads user controls ('AddressInfo') via the loadControl method. I have two other such controls on the same page, both of which function correctly. When the AddressInfoGroup control renders an AddressInfo control to the page, the text boxes in AddressInfo have id's unchanged from the ascx markup. These id's should have been dynamically generated by the .NET clientID process. Because of this, when a second

Implement NumericUpDown spinner control on Windows Phone 7?

*爱你&永不变心* 提交于 2020-02-03 16:23:21
问题 I need a control to enter small numbers on Windows Phone 7 and would like to have some kind of endless spinner control like the one for entering day and month and the date setting of the device. Is there a standard control to spin through these kind of selections? Or at least some way how to build this kind of control? 回答1: There are a few options here - Nick Randolphs' Windows Phone 7 Wheel Control (Clint Rutkas' updated version) Rudi Grobler's LoopingSelector I hope either of these two

User Controls in Windows Forms - Anything similar to ASP.NET User Controls?

杀马特。学长 韩版系。学妹 提交于 2020-02-03 09:55:45
问题 In ASP.NET you have something called "User Controls", which allow you to design a custom control which can be reused in the website. I am now starting developing a Windows application in .NET 2.0 and (surprisingly) I cannot find a similar functionality. What I would like to do is: - Create a new user control in the designer; - Drag & Drop a few controls on it (e.g. buttons, textboxes); - Save, and be able to resuse this user controls by dragging and dropping it on various dialogs. Any

User Controls in Windows Forms - Anything similar to ASP.NET User Controls?

谁都会走 提交于 2020-02-03 09:55:08
问题 In ASP.NET you have something called "User Controls", which allow you to design a custom control which can be reused in the website. I am now starting developing a Windows application in .NET 2.0 and (surprisingly) I cannot find a similar functionality. What I would like to do is: - Create a new user control in the designer; - Drag & Drop a few controls on it (e.g. buttons, textboxes); - Save, and be able to resuse this user controls by dragging and dropping it on various dialogs. Any

passing a string to a User Control

允我心安 提交于 2020-02-02 16:11:18
问题 I'm approaching to Metro App world in this days, please be gentle. Here's the problem: a page receives a string from another page protected override void OnNavigatedTo(NavigationEventArgs e) { Title.Text = e.Parameter.ToString(); } and I need to pass this string to an User Control of the receiving page. How can I pass a parameter from a page to an UserControl of another page? 回答1: Like this: Add a property to your user control: public string MyText { get; set; } Give your user control a name.

C# override WndProc in Control level to detect

谁说我不能喝 提交于 2020-02-02 13:11:10
问题 I have overridden WndProc in UserControl level to detect MouseDown, MouseUp, and MouseMove to any Control added in that UserControl. protected override void WndProc(ref Message m) { Point mouseLoc = new Point(); switch (m.Msg) { case WM_LBUTTONDOWN: System.Diagnostics.Debug.WriteLine("mouse down"); //this.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, mouseLoc.X, mouseLoc.Y, 0)); break; case WM_LBUTTONUP: System.Diagnostics.Debug.WriteLine("mouse up"); //this.OnMouseDown(new

WPF Mouse Down Event won't fire

吃可爱长大的小学妹 提交于 2020-02-01 00:42:07
问题 I must be doing something stupid here but I cant get a MouseDown event to fire when I am clicking on the UserControl. Driving me Mad. Here's the XAML for the UserControl: <UserControl x:Name="cusTextBox" x:Class="StoryboardTool.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"