uielement

I want to drag an image from a Silverlight UIElement and drop it on the users Desktop or Windows Explorer

天大地大妈咪最大 提交于 2019-12-04 06:16:04
I have a Silverlight control containing an image. I want the user to be able to drag the image out of the Silverlight application and drop it anywhere they would be able to drop an image. For example, to the Desktop or to a PowerPoint slide or Word document. Everything that I have read thus far says it cannot be done but I find that hard to believe. I'm very new to Silverlight and RIA development so any help would be much appreciated. Below is the code sample in my WinForm Form but the drag never starts. string[] aString = { imagePath }; DataObject data = new DataObject(DataFormats.FileDrop,

How to make <UIElement> interactable or click-able in WPF UI

烂漫一生 提交于 2019-12-03 15:33:15
This is my first day to design UI using WPF. I have looked up MSDN official document of Flow Document and found that I can place an UI control inside a RichTextBox . I did put a button in but found it's not interactable - I cannot click on it as it's grey. And I also tried other controls and they all displayed fine but just don't support interaction. Even a hyperlink doesn't work. I have searched over internet, the closest question ever asked is about how to make an inside hyperlink click-able: The similar question: C# WPF Text with links I did the same thing but it didn't work! All component

WPF Screenshot JPG from UIElement with C#

霸气de小男生 提交于 2019-12-03 03:50:29
I'm trying to create a JPG from part of my WPF Applications. Like a screenshot, only of individual UIElement s. I started here: http://www.grumpydev.com/2009/01/03/taking-wpf-screenshots/ I am using his extension method, which essential allows you to get a byte[] with UIElement.GetJpgImage() . This can then be written using a filestream to a JPG image. If I make a JPG of the whole window, it looks just fine! However, this is not ideal because it just captures what the user sees. Things that are not visible because of the scrollviewer or because their parent was animated to a small size won't

Silverlight 4 - Render UIElement as an Image

寵の児 提交于 2019-12-01 15:43:27
I have a UIElement that I want to capture a snapshot of when a user clicks a button. When a user clicks the button, I want to take the UIElement and load it's current state into an Image element. How do I render a UIElement as an Image ? Bruno Assuming the FrameworkElement you want to render is named elementToRender and the Image where you want to place the rendered output is called image , use the following code on your button's click handler: var writeableBitmap = new WriteableBitmap((int)elementToRender.RenderSize.Width, (int)elementToRender.RenderSize.Height); writeableBitmap.Render

Silverlight 4 - Render UIElement as an Image

杀马特。学长 韩版系。学妹 提交于 2019-12-01 15:18:16
问题 I have a UIElement that I want to capture a snapshot of when a user clicks a button. When a user clicks the button, I want to take the UIElement and load it's current state into an Image element. How do I render a UIElement as an Image ? 回答1: Assuming the FrameworkElement you want to render is named elementToRender and the Image where you want to place the rendered output is called image , use the following code on your button's click handler: var writeableBitmap = new WriteableBitmap((int

Any way to save an UIElement created programmatically in an image file?

我的未来我决定 提交于 2019-12-01 10:59:20
I'm trying to save an UIElement created programmatically in a JPG/PNG/BMP image in a Windows Phone 8.1 (C#) application. I'm using the class RenderTargetBitmap using the method RenderAsync() but it only works with UI elements created in the XAML code. When I use it on UI elements created directly in C# I have this exception: "System.ArgumentException (Value does not fall within the expected range.)" Am I doing something wrong or this class doesn't allow rendering of UIElement(s) created programmatically? Is there any way to do this on Windows Phone 8.1? Thank you! Here's the code I use:

How make a Screenshot of UIElement in WPF

核能气质少年 提交于 2019-12-01 10:56:03
I have a problem with creating a screenshot of a scatterview. My screenshot always contains a black frame. Here's my XAML-Code: <s:SurfaceWindow xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="http://schemas.microsoft.com/surface/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="MakeScreenshots.SurfaceWindow1" Title="MakeScreenshots" Width="1000" Height="700" > <s:SurfaceWindow.Resources> <ImageBrush

Delay in drag/drop of UIElement in Windows Phone 8.1

允我心安 提交于 2019-12-01 08:13:59
问题 I'm using the ManipulationDelta event handler to drag and drop a simple ellipse in a canvas across the screen. I'm using the standard approach posted online in several places. Following is the code in my event handler: Ellipse dragableItem = sender as Ellipse; TranslateTransform translateTransform = dragableItem.RenderTransform as TranslateTransform; double newPosX = Canvas.GetLeft(dragableItem) + translateTransform.X + e.Delta.Translation.X; double newPosY = Canvas.GetTop(dragableItem) +

WPF ListBox - Getting UIElement instead of of SelectedItem

邮差的信 提交于 2019-12-01 02:44:31
I created a ListBox that has a DataTemplate as Itemtemplate . However, is there an easy way to access the generated UIElement instead of the SelectedItem in codebehind? When I access SelectedItem , I just get the selected object from my ItemsSource collection. Is there a way to access the UIElement (ie. the element generated from the DataTemplate together with the bound object)? Szymon Rozga You are looking for the ItemContainerGenerator property. Each ItemsSource has an ItemContainerGenerator instance. This class has the following method that might interest you: ContainerFromItem(object

Absolute coordinates of UIElement in WinRT

大憨熊 提交于 2019-11-30 19:08:18
Cannot find a way to locate absolute position of an UIElement in Metro style app. Anybody know the solution? (the context: I want a Popup to be shown next to the button called it) This should work... private void Button_Click(object sender, RoutedEventArgs e) { var button = sender as Button; var ttv = button.TransformToVisual(Window.Current.Content); Point screenCoords = ttv.TransformPoint(new Point(0, 0)); } 来源: https://stackoverflow.com/questions/12161584/absolute-coordinates-of-uielement-in-winrt