uielement

Having trouble with custom panel coding -- can't figure out how to access properties of children

I'm working on a timeline that marks regions of audio signals when the user clicks the start and stop button. The user may click start and stop multiple times during a sampling session, and the time between presses should appear in the timeline as highlighted sections. The overall design is an ItemsControl whose ItemsPanelTemplate is a...

New TabItem Content ActualHeight crashes Xaml Window

I am able to create new TabItems with Content dynamically to a new window by streaming the Xaml with XamlReader: NewWindow newWindow = new NewWindow(); newWindow.Show(); TabControl myTabCntrol = newWindow.FindName("GBtabControl") as TabControl; StringReader stringReader = new StringReader(XamlGrid); XmlReader xmlReader =...

How to loop through controls within TabItem

Hi, I'd like to loop through the controls within a TabItem. my xaml is something like TabControl TabItem ScrollViewer Grid I have tried TabItem ti = TabControl.Selected as TabItem foreach (UIElement control in ti) ... Which causes an error Basically I would like to get to the ScrollViewer Content or Grid Any ideas??...

C#/WPF - RoutedEvent in WPF class that isn't a UIElement

I have a class that needs to notify that something significant has occured. The class is in a WPF-project, even though this specific class, is lookless (and doesn't inherit from UIElement, neither directly or indirectly). Normally, I just register a RoutedEvent to get this functionality but as this class neither has AddHandler nor Remo...

WPF FrameworkElement Parent and Moving a UIElement

I'm trying to move a control from one parent to another (if this will work I'm not quite sure). I can get a hold of the control that I want to move. Here is my code: public void MoveElement(UIElement uiElement) { var element = ((FrameworkElement)uiElement).Parent; //TODO:Remove from parent myControl.Children.Add(uiElement); ...

Detect changes to user input controls in Silverlight?

I have a childwindow with a number of Textboxes, Comboboxes, and DatePickers. I want to know if a user has changed any value in these (to know if I need to save to db) One way I could think of doing this are in the 'on chg' event handlers and set bool. But if a user changes the value, in say a combobox, then changes back to the origin...

WPF Delay Refresh of UI Elements in ItemsControl

Hello All, The short question is - how can I prevent (delay) a bound UI element from refreshing until I want it to? The longer explanation: I have a process that adds a number of items to an ItemsControl, and then performs some additional calculations on those items using a background thread. This (correctly) updates the items as it g...

Snow Leopard & LSUIElement -> application not activating properly, window not "active" despite being "key"

Hi, I'm running into a few problem with a background application that uses LSUIElement=1 to hide its dock item, menu bar and prevent it from appearing in the Command-Tab application switcher. It seems to be a Snow Leopard only problem. The application places an NSStatusItem in the menu bar and pops up a menu when clicked on. Selecting...

Commit Focused Element in Silverlight

I need code that will force Silverlight to commit the focused element (in my case a TextBox, but it could be anything). In WPF I use public static void CommitFocusedElement() { UIElement element = Keyboard.FocusedElement as UIElement; if (element != null) { TraversalRequest request = new TraversalReq...

Casting error for UIElement on runtime

Hi Guys, I get runtime error when I do this... I have this class... public abstract class AnnObject : DependencyObject and when I do this it compiles fine, but throws a runtime error... AnnObject aa; var b = (DependencyObject)aa; var c = (UIElement)b; The error I get is cannot cast AnnObject to UIElement.... Can someone please b...

Mac OS - get UI element information at a coordinate in screen if any

Hi all, this is my first post, wish your help. In Mac OS (10.5 or 10.6), I want to find the element at the specified coordinate in screen. If you have ever used UIElementInspector, you will konw exactly what I mean. Move mouse cursor around with UIElementInspector running, you will get a detail description, which is what I want, about...

WPF Element Binding With Dynamically Generated UI Elements

I have a page in which I have a grid with 2 columns, one accommodating 80* width and the other accommodating 20*. Beneath the grid is a stack panel to which I load UI elements (child stack panels) at runtime. My objective is to bind the widths of the stackpanels to the columns of the grid. This works perfectly and the stackpenels resiz...

Windows Phone 7 Global UI Element?

Hi, I'm trying to add a Global UIElement in my Windows Phone 7 app (ie. a UIElement that is shared across all pages) Specifically, I'm trying to get the MediaElement to continue playing when I navigate to different pages. I've tried playing with the Application.RootVisual / PhoneApplicationFrame but I can't seem to get it to work Any...

Select a WPF UIElement in a FlowDocument

Hi, I have a FlowDocument (inside a RichTextBox) that contains UIElement controls such as CheckBoxes. I need the user to be able to click on the CheckBox to select it to change the controls properties such as label, background color etc. The problem I have is that when I click it it only checks, or unchecks the CheckBox as you would exp...

Problem sending UIElements via DependencyProperty in wpf

I have a usercontrol with a dependencyproperty that takes oen UIElement. So fare so good, the problem is I can not find the element's children. I think the problem is my lack of knowledge, could anyone tell me what the problem is and a possible solution? I have made a small test-program like this Usercontrol codebehinde: public UIEle...

Move UIElement in Visual Tree without recalculating layout

We have a WPF application (.Net 4.0) using a Docking Control (Actipro). We can dock out the docking windows. In that case, a "real" Window is created and the content is assigned to that window. Of course, moving stuff in the Visual Tree will re-trigger the complete layouting. This is problematic, because in one of these docking windows,...

How to get all the UI Element into a stackpanel

Am using the below function to get the topmost parent in my application. private DependencyObject GetTopParent() { DependencyObject dpParent = this.Parent; do { dpParent = LogicalTreeHelper.GetParent(dpParent); } while (dpParent.GetType().BaseType != typeof(Window)); return dpParen...

How can I modify a UIElement's contents?

Hello. Is there a way to modify a UIElement's contents? I have something like this: System.IO.FileStream rdr = System.IO.File.OpenRead(xamlFilePath); System.Windows.UIElement uie = (System.Windows.UIElement)System.Windows.Markup.XamlReader.Load(rdr); And when I run the debugger and add uie to the "Watch" window, it gives me the foll...

Form.Show() is "Not Responding..."

Hello. I have a little trivial problem in my application. I have a dialog (d1) that inherits from Form. And in Main, if I call d1.ShowDialog ,it works fine. But calling d1.Show() opens a bad form with pale labels and textboxes, and when I try to drag that window form it says "Not Responding." What's going on? I think I need "Show"...