user-controls

How to implement an image or pdf viewer?

我与影子孤独终老i 提交于 2020-01-25 13:15:21
问题 for learning purposes I would like to know how to implement an image (and/or) pdf viewer on my own. I'm interested in the general approach to implement such a thing. I already read about the different formats on the net (tiff/pdf) so I found out that these files have a special format which describes where I have to look for a header, where the footer is and where the image information (in decrypted form) is. Because I think such a viewer works sth. like: opening the file reading different

Why do Items from one comboBox not copy to another?

不羁岁月 提交于 2020-01-25 12:25:49
问题 I have multiple comboboxes on a tabpage on a tabcontrol on a form. Trying to loop through the controls has not worked (see this). So, I tried to go at it from another angle: finding the controls based on their name. As an initial POC, I just wanted to brute force it by providing the name of one of the combo boxes that is empty at design time ("cmbxRow0Element1") and assign the items from cmbxRow0Element0 to it. But both this attempt: Control ctrl = this.Controls["cmbxRow0Element1"]; ComboBox

Adding event handlers by using reflection

假如想象 提交于 2020-01-25 10:32:04
问题 I am adding dynamically controls to page by using LoadControl and Controls.Add. I need somehow to wrap Init and Load event handlers of this loaded controls into my code. So it should be such order of events SomeMyCode() -> Control.Init() -> AnotherMyCode() and the same for Load SomeMyCode() -> Control.Load() -> AnotherMyCode() . My idea was to Get List of Control's event handlers for Init and Load events and add first and last event handers with code I should to run. But I cannot figure out

Question concerning asp:listview and multiple dynamically created controls

南楼画角 提交于 2020-01-25 10:10:09
问题 I have a listview that displays a list of textboxes that get created on a button click. I would also like a label to be created next to each txtbox that would increment what is says from step x: to step x+1: Do I need to create another listview control for this, or is there a much easier way (which I hope)? Here is the current web code for my listview: <tr align="center" valign="middle"> <td> <asp:ListView ID="lvDynamicTextboxes" runat="server" ItemPlaceholderID="itemPlaceholder"

Reordering controls in a regular panel

你离开我真会死。 提交于 2020-01-25 04:06:09
问题 ContolPanel is type: FlowLayoutPanel sender is a panel that i have a click on. How do i reorder the order my Usercontrols is set in my FlowLayoutPanel? This is how i add my Objekts(UserControls) to my FlowLayoutPanel private void button1_Click_1(object sender, EventArgs e) { int count = 0; var panel = sender as Panel; switch (panel.Name) { case "TypePanel": ContolPanel.Controls.Add(new Type().Initialize(_ConnectionStr, _connection, _brugerLNr, _klinikLNr, _speciale, _ICPC, _segmenterStrings)

WPF - Animations in a user control, learning, trying to understand, but feeling n00bish

我的未来我决定 提交于 2020-01-24 22:57:07
问题 OK I'm redoing this since I messed it up. :) here's the xaml. <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="ucWaitIndicator.Window1" x:Name="Window" Title="Window1" Width="640" Height="480"> <Window.Resources> <Storyboard x:Key="OnLoaded1"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="path" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2]

Return value from usercontrol after user action

家住魔仙堡 提交于 2020-01-24 09:33:33
问题 Essentially I need the same thing that Form.ShowDialog() offers, but with a UserControl. Inside a winform, I load a UserControl, which should allow a user to select an item from a list, and return it back to the caller. For example: var item = myUserControl.SelectItem(); Obviously, returning from a control's method is very simple. But how can I make it wait until user performs the required action with the control? I can subscribe to an event of the control, but this path is not ideal. Put

Return value from usercontrol after user action

我的未来我决定 提交于 2020-01-24 09:33:07
问题 Essentially I need the same thing that Form.ShowDialog() offers, but with a UserControl. Inside a winform, I load a UserControl, which should allow a user to select an item from a list, and return it back to the caller. For example: var item = myUserControl.SelectItem(); Obviously, returning from a control's method is very simple. But how can I make it wait until user performs the required action with the control? I can subscribe to an event of the control, but this path is not ideal. Put

How to close parent windows using WPF User Control

情到浓时终转凉″ 提交于 2020-01-24 04:08:28
问题 Assume that I have two WPF windows: window_One and window_Two. window_One has one button. Clicking this button opens window_Two. window_Two contains a User Control. This user control has one button that closes window_Two. How can I achieve this scenario? 回答1: Inside the custom control that you've created. You can access the parent window from within the button event click. Either by using the visual tree: var myWindow = (Window)VisualParent.GetSelfAndAncestors().FirstOrDefault(a => a is

How to access a user control in a masterpage from a content page?

情到浓时终转凉″ 提交于 2020-01-22 15:17:08
问题 Lets say that I have a header user control in a master page, and want to change a property of the user control depending on what content page is loaded inside of the master page. How might I go about this? Thanks! 回答1: You can use two methods. The first is by using Page.Master.FindControl('controlID') . Then you can cast it to the type of your user control. The second method is by adding a <%@ MasterType VirtualPath=""> OR <%@ MasterType TypeName=""%> tag to your aspx page. In the VirtualPath