.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Adorner for non UIElement

Posted By:      Posted Date: October 13, 2010    Points: 0   Category :WPF

Hi! I need add an adorner to elements wich can be used in FlowDocument.

As we know, there are we can use elements like Paragraph, Figure, Run etc. But its not derived from FrameworkElement and so we cant add adorner for its items. (More over its elements has no size and location proprties. :-))

Anybody decides a similar problem?


View Complete Post

More Related Resource Links

Drag Drop adorner visual performance

Hi, I've been modifying my application based on a MSDN blog post on WPF drag and drop.   While I found the blog post very helpful, what I've noticed when trying to use a visual for a drag indicator (rather than either a default or custom cursor), is that the visual doesn't 'keep up' with the cursor movement.  That is, if I move the mouse quickly during a drag/drop operation, there is a space between the visual adorner being moved around and the cursor.  When I stop movement (but still have the mouse button down so the drag/drop operation is still active), the visual 'catches up' with the standard cursor.  And if I were to move the mouse slower, then the standard cursor and the drag drop visual positions are kept in sync. This lag between the movement of the 'real' cursor and the visual is even more obvious in my application than in blog post sample application, although it is present in the sample application as well.  My question is, is there anyway to improve the performance of a custom drag drop operation using a visual such that I can quickly move around the mouse and not see a gap between the cursor and the visual? Thanks, Notre

how to create property widget and change the properties of dragged-dropped UIelement in canvas in wp

I'm new in WPF development. I'd like to learn it. I'm curious and having problem in developing property widget for the UIElements. I want to change the properties of the dragged and dropped UIElement from the Property widget. How could I do this? I'd glad if any help is suggested. I've listbox and canvas. Elements from listbox can be dropped to the canvas. I'm trying to change the properties of the dropped element through a property widget. I don't know how to do this. I'd be grateful to any kind of support.   Regards, Binaya

Adorner problem in derived DataGridTextColumn

Hi,  I'm having problems with disappearing adorners when scrolling a DataGrid.  The adorners are implemented inside a custom DataGridTextColumn.  I'm not sure what to try from here, but I've made a simple demo app (see below) that shows the problem.  The idea to do this this way came from Martin's Blog suggestion.  Any suggestions appreciated... Main Window: (.cs is empty) <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="DataGridTemplateSample.Window1" xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit" xmlns:local="clr-namespace:DataGridTemplateSample" x:Name="Window" Title="Window1" Width="640" Height="280"> <Window.Resources> <ObjectDataProvider x:Key="TestData" ObjectInstance="{x:Static local:Data.TestData}" /> </Window.Resources> <Grid x:Name="LayoutRoot"> <dg:DataGrid x:Name="datagrid" AutoGenerateColumns="False" ItemsSource="{Binding Source={StaticResource TestData}}"> <dg:DataGrid.Columns> <dg:DataGridTextColumn x:Name="Column1" Binding="{Binding col1}" Header=&q

When exactly does UIElement.LostFocus fire?

I am observing that if a control is deep within the Visual tree of a user control, and I click on another element further up or down the tree, UIElement.LostFocus does not fire.  If, however, I click on a closer element or its immediate parent, LostFocus fires correctly.  Am I missing something?

Need to get unclipped image of UIElement

I am new to WPF and am rehosting the .Net Workflow Foundation v4 WorkflowDesigner class in a WPF app.   Two "View" WPF UIElements which are exposed as child properties of the Designer class are mounted in two grid columns; including one View which paints a flowchart-like diagram of the current workflow.   Unfortunately, the current implementation does not support any kind of "print" capability which is a requirement for this app.   The class supports a "SaveAsImage" method, but it is hard-coded to pop a FileOpenDialog and save directly to disk; something that won't work for our application". After reading threads in this forum and others, I have tried several techniques to grab a full-size, non-clipped "screenshot" like image of this UIElement.   But unlike the WorkflowDesigner's private internal methods I've examined in Reflector, every technique I've tried has clipped at the dimensions of the Grid column and row in which the view is mounted.  (At one point, I tried duplicating the decompiled class' private code methods differing only in how I obtained the View's ContentPresenter since I don't have access to the internal variables, but the resulting image was still clipped/truncated). Below is one presentative method for grabbing the UIElement content as a JPeg.  &nbs

how to binding commandparameter to UIelement with out using ElementName?



I want to use data binding to bind a UIElement as a commandparameter, the only way I cn do this is to use the elementName.

I want to know if there is another way of doing the same thing without using the elementName?(get rid of "ElementName=myMediaElement")

Code follows:

<MediaElement x:Name="myMediaElement" />

<Button HorizontalAlignment="Center" Width="30" Background="Transparent" 

    Command="{Binding CaptureCommand}" 

CommandParameter="{Binding ElementName=myMediaElement}"





VisualTreeHelper.HitTest on UIElement that has been collapsed


In this simple WPF sample, the UIElement that has been collapsed at run-time still get reported by VisualTreeHelper.HitTest when another visible UIElement overlaps it.

To replicate:

  1. Copy the following code in a WPF application. Run the application.
  2. Notice the red ellipse is currently visible. Click Select button to collapse it.
  3. Click to where the red ellipse used to be.
  4. If you clicked where the blue ellipse and the red ellipse used to overlap, the red ellipse is still reported.
  5. If you clicked where only the red ellipse used to exist, the red ellipse is not reported.


<Grid x:Name="LayoutRoot" MouseLeftButtonDown="Grid_MouseLeftButtonDown">
<Ellipse x:Name=

Include Adorner in HitTest

I have a custom Shape MyLine in which I use an adorner that draws some text near the line(lines description).

Now, my problem is that the MyShape is not identified when the user hits not on the line "body" but on that description text.

I tried this on MyLine but this does not even compile:
  protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters)
    HitTestResult result = base.HitTestCore(hitTestParameters);
    if (result == null)
      result = adorner.InputHitTest(hitTestParameters.HitPoint);

Best regards, Sergiu
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend