user-controls

Loading a WPF control embedded in a DLL in runtime

[亡魂溺海] 提交于 2020-08-23 09:09:24
问题 In my WPF project, I have a dll that contains several WPF UserControls. I would like, in runtime, to be able to check a parameter in the database (already implemented) and according to that parameter (which is a string) to be able to load a specific UserControl to my View. The UserControl is actually a Canvas, so it basically just places the correct Canvas on the View according to the database entry. I don't know if I was clear, so please ask me if you didn't understand the question. Thanks

How to add my UserControl from another project (Dll) into my WPF Solution?

你离开我真会死。 提交于 2020-08-05 08:58:48
问题 So, everything is in the title, I just want to add a UserControl in my WPF Window. It looks like easy but the UserControl is in another project (Dll project) in the same solution. And I just can't reference it. So, my best try is something like that: <Window xmlns:local="clr-namespace:MyWindowProject" x:Name="window" xmlns:other="clr-namespace:MyDllProject" x:Class="MyWindowProject.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft

RelativeSource-Binding for UserControl

爱⌒轻易说出口 提交于 2020-07-30 03:16:09
问题 I've created a UserControl for displaying a Hyperlink in my application. The markup of this UserControl looks like: <UserControl x:Class="MVVMExample.View.UserControls.ActionLink" 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="300" d:DesignWidth="300"

RelativeSource-Binding for UserControl

南楼画角 提交于 2020-07-30 03:15:07
问题 I've created a UserControl for displaying a Hyperlink in my application. The markup of this UserControl looks like: <UserControl x:Class="MVVMExample.View.UserControls.ActionLink" 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="300" d:DesignWidth="300"

Strange ActiveX Listbox behavior in Excel

 ̄綄美尐妖づ 提交于 2020-07-22 10:25:27
问题 In Excel 2007 SP3, I have a workbook with a multi-column, multi-select ActiveX listbox. On most computers it works fine. But on one user's computer, when I read from that listbox and write data from it to another sheet, it's font gets smaller. And smaller again each time the command button that does task is clicked. All of our computers are on Excel 2007 SP3 and Windows 7. Only one of them has this problem; it works fine on the others. Stepping through the code on the affected computer, I

Pass ViewModel to UserControl

本秂侑毒 提交于 2020-07-03 20:20:38
问题 MySpecialView is a complex image control, I would like to reuse it from different views and pass its ViewModel as in this example. MainWindow.xaml <Window x:Class="YouBug.MainWindow" 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:YouBug" mc:Ignorable="d"

Label of UserControl is hiding MouseEnter event

拥有回忆 提交于 2020-06-17 00:08:24
问题 I can't active the event mouse enter because label's on top. I try assign the same event, but when I call MyUserControl myUserControl = (MyUserControl)sender; results in error. Here's my code: foreach (Control ctrl in MyUserControl.Controls) { ctrl.MouseEnter += MyUserControl_MouseEnter; } private void MyUserControl_MouseEnter(object sender, EventArgs e) { MyUserControl myUC = (MyUserControl)sender; int test = myUC .Codigo; } the event (Form_MouseEnter) works when it occurs in the form, but

Label of UserControl is hiding MouseEnter event

二次信任 提交于 2020-06-17 00:05:05
问题 I can't active the event mouse enter because label's on top. I try assign the same event, but when I call MyUserControl myUserControl = (MyUserControl)sender; results in error. Here's my code: foreach (Control ctrl in MyUserControl.Controls) { ctrl.MouseEnter += MyUserControl_MouseEnter; } private void MyUserControl_MouseEnter(object sender, EventArgs e) { MyUserControl myUC = (MyUserControl)sender; int test = myUC .Codigo; } the event (Form_MouseEnter) works when it occurs in the form, but

Which UserControl's calling Event MouseEnter?

空扰寡人 提交于 2020-06-16 17:27:07
问题 I have a list of UserControl and I want to know which UserControl is calling event MouseEnter . I add multiple UserControl s on TableLayoutPanel . List<MyUserControl> form = new List<MyUserControl>(); for (int x = 0; x < dt.Rows.Count; x++) { tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 200)); if (x == 0) tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.AutoSize)); form.Add(new MyUserControl()); } for (int x = 0; x < form.Count; x++) { form[x].MouseEnter += new

UserControl VS Page in WPF

心不动则不痛 提交于 2020-06-08 14:50:46
问题 I'm on writing a simple application, it has a menu and when user choices each MenuItem , i want to change my window's content to display the selected content. i have two option to that. i can add a <Frame></Frame> to my window and write some pages. i can write some UserControls and put them in a ContentControl as user fires MenuItem click event. so I'm confused to select the right choice for this purpose. 回答1: Navigation can be succefully implemented by using Frame/Pages or ContentControl