uielement

Export FlowDocument with UIElement to rtf

末鹿安然 提交于 2020-01-24 17:13:11
问题 I am trying to export a FlowDocument which contains a grid to rtf. I used the following code using (FileStream fs = new FileStream(@"C:\demo.rtf", FileMode.OpenOrCreate, FileAccess.Write)) { TextRange textRange = new TextRange(doc.ContentStart, doc.ContentEnd); textRange.Save(fs, DataFormats.Rtf); } However I am getting a blank document. How can this be solved? 回答1: I had a similar issue recently and the culprit turned out to be the FileMode.OpenOrCreate It should have been FileMode.Create

Getting the top left coordinates of a WPF UIElement

牧云@^-^@ 提交于 2020-01-21 06:24:05
问题 I am working on extending the Microsoft resize Adorner example and need to be able to reposition the element after say the bottom left drag handle has been dragged. So if I have a textbox of say 150 wide, 35 high postitioned on my form, and the bottom left drag handle changes the width to 200 wide, the right hand of the text box remains unchanged but the left hand edge moves to the left. So I need to know the top left coordinates of the UIElement. I have tried Canvas.GetLeft and Canvas.GetTop

Getting the top left coordinates of a WPF UIElement

百般思念 提交于 2020-01-21 06:23:39
问题 I am working on extending the Microsoft resize Adorner example and need to be able to reposition the element after say the bottom left drag handle has been dragged. So if I have a textbox of say 150 wide, 35 high postitioned on my form, and the bottom left drag handle changes the width to 200 wide, the right hand of the text box remains unchanged but the left hand edge moves to the left. So I need to know the top left coordinates of the UIElement. I have tried Canvas.GetLeft and Canvas.GetTop

Getting the top left coordinates of a WPF UIElement

时光毁灭记忆、已成空白 提交于 2020-01-21 06:23:04
问题 I am working on extending the Microsoft resize Adorner example and need to be able to reposition the element after say the bottom left drag handle has been dragged. So if I have a textbox of say 150 wide, 35 high postitioned on my form, and the bottom left drag handle changes the width to 200 wide, the right hand of the text box remains unchanged but the left hand edge moves to the left. So I need to know the top left coordinates of the UIElement. I have tried Canvas.GetLeft and Canvas.GetTop

In WPF, how can I get the RowDefinition object from the UIElement that belongs to it?

和自甴很熟 提交于 2020-01-04 09:09:44
问题 Take the following window layout for example: There is a Grid element defined. It has 3 rows. Each row has one Button element. How do I get the RowDefinition object of the Button it belongs to? Thanks. NOTE: By calling Grid.GetRow(Button element) , I am getting the Grid.Row property of that Button element. I do not need that - instead I need the actual RowDefinition object. 回答1: Like this: int rowIndex = Grid.GetRow(myButton); RowDefinition rowDef = myGrid.RowDefinitions[rowIndex]; Or in one

JavaFX application hide OSX dock icon

 ̄綄美尐妖づ 提交于 2020-01-02 16:23:10
问题 I need to hide the dock icon of my javafx application. In a normal java application this can be achieved by the following property: System.setProperty("apple.awt.UIElement", "true"); However, this does not seems to work with JavaFX. Thanks! 回答1: Just tried it. You have to modify *.app/Contents/Info.plist and add <key>LSUIElement</key> <string>1</string> Simple example: <?xml version="1.0" ?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

Find position of Button/UIElement on screen relative to grid Windows Phone

孤者浪人 提交于 2019-12-30 06:08:41
问题 I can't find a way to get the position in (x,y) co-ordinates of an on-screen control like a button relative to the grid that it is inside. Is there a way to do this that I am overlooking? 回答1: var transform = button.TransformToVisual(grid); Point absolutePosition = transform.Transform(new Point(0, 0)); From How to get the position of an element in a StackPanel?. 来源: https://stackoverflow.com/questions/8206294/find-position-of-button-uielement-on-screen-relative-to-grid-windows-phone

Align buttons to the bottom of the layout

流过昼夜 提交于 2019-12-25 18:43:43
问题 i want to align two buttons to the bottom of the screen as follows. i tried the xml given in this similar question but no luck.how to do it ? like this - this should be without the spacing in the bottom 回答1: This is the property you need to use: android:layout_alignParentBottom="true" Try using the following XML and customize your button appearance as you like: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android

WPF: Can I get the size of a UIElement AFTER a transform is applied?

被刻印的时光 ゝ 提交于 2019-12-24 04:54:26
问题 In WPF/Silverlight, can I get the calculated value of a UIElement after a transformation is applied? (Per the comment below): I've got a stack panel and I've applied a TranformGroup to it. There are two translate and one scale transforms in this group. (warning, psuedo code ahead) groupTransform.children.add(new TranslateTransform()); groupTransform.children.add(new ScaleTransform()); groupTransform.children.add(new TranslateTransform()); containerToScale.RenderTransform = groupTransform; ...

All UIElements become inaccessible after animation completes

此生再无相见时 提交于 2019-12-23 21:14:10
问题 I am trying to implement city lights animations by having an array of CGRect's with the coordinates of each light. Then creating UIViews around these CGRects. This logic (Thanks to Darren for helping with this logic) is working fine however after the animation is complete, all other elements (UIButtons, Sliders, Other UIImageViews etc) on screen become inaccessible. Even my Swipe gestures are not responding. Before and during the animation, all elements respond well BUT once the animation is