user-controls

Binding Silverlight UserControl custom properties to its' elements

我的未来我决定 提交于 2019-12-31 19:42:44
问题 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'

Binding Silverlight UserControl custom properties to its' elements

心已入冬 提交于 2019-12-31 19:42:18
问题 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'

Visual Studio Designer is always trying to change my control

谁都会走 提交于 2019-12-31 13:44:18
问题 I have a somewhat complex UserControl, and Visual Studio 2008 is giving me a rather harmless annoyance when working with it. Every single time I open the control with the Designer, it decides to immediately change some of the harmless values set by the designer - namely the initialization of Size properties. If I save those changes, close, and reopen, it almost invariably ends up deciding another component of my control needs its initial size changed, ad infinitum. Luckily these changes are

When to add a Component Class vs User Control?

感情迁移 提交于 2019-12-31 13:01:29
问题 I have a general idea, and there are some obvious cases, but there are also some gray areas for me - when is it best to use to extend from a component and when is it best to create a user control? This pertains to a specific work problem I am trying to solve, but the specifics of that are not important - a general answer to this question is enough for me. 回答1: In WPF and Windows Forms, both, the main difference is that a UserControl is meant to be a collection of controls - a reusable, single

Notified when media player opens from UIWebView?

痴心易碎 提交于 2019-12-31 10:53:41
问题 I have got a UIViewController in my app with a UIWebView in it. The UIWebView is fixed-size and configured to open any links in a new UIViewController (browser). This works, but when I try clicking a video like YouTube or Vimeo from within the web view, it opens on top of the view controller. This would normally not be a problem, but I have an overlapping view that needs to get a message to move out of the way when this happens. Is there a notification or any other way my view controller can

Can't access GridView event at usercontrol by codebehind

半腔热情 提交于 2019-12-31 07:33:53
问题 IpInterfaceUC UserControl <div id="dvChannel" runat="server"> <asp:GridView ID="gvChannelUC" OnRowCommand="gvChannelUC_RowCommand" OnSelectedIndexChanged="gvChannel_SelectedIndexChanged" /> </div> IPServices page CodeBehind if (!IsPostBack){ }else { string str_btn = Request.Form.Keys[Request.Form.Keys.Count - 1].ToString(); handleClick(str_btn); } Question It always show str_btn is null.If I click Button,It'll show button's id.But when I click Select at GridView,It show str_btn is null.It

Nested User Controls - how to best get a reference to an ancestor control

别说谁变了你拦得住时间么 提交于 2019-12-31 05:05:42
问题 I realize that a whole lot of code cannot fit here, but I am asking for general direction or pointer. I have .NET user controls nested six deep for an interactive gadget with (outer to inner) of : wrapper, tabs, panels, lists, rows, items. I am trying to get a reference to an ancestor control from a nested control. Specifically, I have this code in the code behind of a embedded "great great grand child" control. It works, but it is very ugly: MyTab _myTab = this.Parent.Parent.Parent.Parent

ASP.NET dynamically adding UserControl to PlaceHolder, not fire Click Event, only Page_Load

亡梦爱人 提交于 2019-12-31 05:01:09
问题 In my ASP.Net page I have PlaceHolder and Button. When user click on this button, I add some UserControls from my Interface method getControl to the PlaceHolder. Code: protected void ActionBtn_Click(object sender, EventArgs e) { if (provider != null) { actualObject = (PlaceHolder)provider.getControl(); PlaceHolder1.Controls.Add(actualObject); } } Method getControl: public object getControl() { ph = new PlaceHolder(); exportInbBtn = new Button(); exportInbBtn.Text = "Export Inventury";

Handling windows notifications in derived C# user control

故事扮演 提交于 2019-12-31 04:47:07
问题 How can I handle any of the tree view notifications listed here in a C# class that is derived from the .NET TreeView control? I tried to handle the click notification, for example, like this: class ExtendedTreeView : TreeView { private const Int32 NM_FIRST = (Int32)(0U - 0U); private const Int32 NM_CLICK = unchecked((Int32)((UInt32)NM_FIRST - 2U)); protected override void WndProc(ref Message m) { if (m.Msg == NM_CLICK) { MessageBox.Show("NM_CLICK"); } base.WndProc(ref m); } } But the message

how to use dependency property to replace the parameter in the constructor of a UserControl?

戏子无情 提交于 2019-12-31 03:56:08
问题 I noticed that similar questions have been asked before but I did not find any detailed examples. I have a winform program, its constructor has a parameter cn: public AddFailure(ProSimConnect cn)// constructor in winform { this.connection = cn; InitializeComponent(); ... } Now I need to simulate it in a UserControl in WPF and put it into MainWindow. In MainWindow.xaml: <Border ...> <IOS:Core_System/> </Border> I want to do this but I know I can't because it shouldn't have any parameter: