Questions tagged [frameworkelement]

Provides properties, events and methods to elements to support WPF framework level capabilities such as layout, object lifetime events, databinding and styles.

120 questions
21
votes
4 answers

Specified element is already the logical child of another element. Disconnect it first

here is the error I have when I want to attach a FrameworkElement to a new Window to publish it to a PNG file. So my idea is to remove the parent-child link, call my method, and add the child again with this code…
Guillaume Slashy
  • 3,554
  • 8
  • 43
  • 68
16
votes
2 answers

Find control position on canvas

I have a Canvas which contains a few Textblocks and I need to find the top and left corner points that were assigned in the XAML Document. How can I get those two properties? When I loop through the Framework Elements on the Canvas I can't seem to…
user337816
  • 365
  • 2
  • 5
  • 13
15
votes
2 answers

UIElement vs FrameworkElement in WPF/Silverlight

When do I derive from UIElement and FrameworkElement considering FrameworkElement inherits UIElement. Can anyone give real life examples?
Greens
  • 3,061
  • 11
  • 43
  • 61
13
votes
3 answers

How do I programmatically get the current Visual State of a WPF FrameworkElement?

How do I programmatically get the current Visual State of a WPF FrameworkElement? And by state I mean the states like "Normal", "MouseOver", "Disabled", etc. EDIT: Basically, I am changing the Visual state of a button with…
Kyle
  • 21,377
  • 37
  • 113
  • 200
12
votes
2 answers

WPF FrameworkElement not receiving Mouse input

Trying to get OnMouse events appearing in a child FrameworkElement. The parent element is a Panel (and the Background property is not Null). class MyFrameworkElement : FrameworkElement { protected override void OnMouseDown(MouseButtonEventArgs…
lava
  • 121
  • 3
10
votes
2 answers

FrameworkElement.Name problem

I am attempting to set the Name property of a Page in the constructor: public partial class PageListView : Page { public PageListView(string title) { InitializeComponent(); Name = title; } } However, I often get the…
ocodo
  • 29,401
  • 18
  • 105
  • 117
10
votes
4 answers

FrameworkElement`s DataContext Property does NOT inherit down the element tree

Hello WPF Pros at least I hope some of you read this! DataContext is a property on FrameworkElement (base class for all WPF Controls) and is implemented as a DependencyProperty. That means all the descendant elements in the logical tree share the…
Elisabeth
  • 20,496
  • 52
  • 200
  • 321
7
votes
1 answer

UIElement vs FrameworkElement

I am unclear about when you would use a UIElement as opposed to a FrameworkElement, and why is there a FrameworkElement class at at all. Essentially, what is the extra functionality that a FrameworkElement provides as opposed to UIElement?
mihajlv
  • 2,275
  • 4
  • 36
  • 59
7
votes
1 answer

Using data binding on value which is a FrameworkElement

One of my data sources produces a collection of values which are typed to the following interface public interface IData { string Name { get; } FrameworkElement VisualElement { get; } } I'd like to use data binding in WPF to display a…
JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454
6
votes
1 answer

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 =…
Adam Driscoll
  • 9,395
  • 9
  • 61
  • 104
6
votes
1 answer

How to programmatically access ToolTipService of a Silverlight FrameworkElement?

We have a languaging mechanism that recurses through our XAML pages when they load, examines each element for a Tag property and uses its value to retrieve a string resource to apply to the element. It doesn't currently support tooltips and we have…
Steve Crane
  • 4,340
  • 5
  • 40
  • 63
4
votes
2 answers

FrameworkElement.Parent and VisualtreeHelper.GetParent behaves differently

In a WP7 app, I used FrameworkElement.Parent recursively to determine whether a specific element is inside of another element. But it does not always work correctly. Then I changed my code to use VisualtreeHelper.GetParent method recursively, and it…
4
votes
5 answers

In WPF, how to add an EventHandler for a FrameworkElement designed in Template?

I have defined the following DataTemplate for ListBox items in an external resource dictionary:
Boris
  • 9,986
  • 34
  • 110
  • 147
4
votes
2 answers

WPF element that dynamically creates (encapsulated) children at runtime

I want to create a WPF element that, at runtime, is in full control of its child elements -- adding and removing child UI when its properties change. Something a bit like what ItemsControl does when you modify its ItemsSource property, though in my…
Joe White
  • 94,807
  • 60
  • 220
  • 330
4
votes
1 answer

Apply DataTemplate to type derived from FrameworkElement

I've got a list of custom "pages" in my app. Each page represents a different UI view. They have some simple properties, like a string title and an icon, but they also have a number of complex properties, consisting of controls to insert into the…
user180885
1
2 3 4 5 6 7 8