autosize

TextBox expanding with surrounding Grid but not with text

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 08:55:29
问题 A window has a Grid with two columns. The left column contains a control with a constant width but with a height that adapts. The right column contains a TextBox that takes up all remaining space in the Grid (and thereby in the Window). The Grid is given a minimal width and height and is wrapped within a ScrollViewer. If the user resizes the window to be smaller than the minimal width/height of the Grid, scrollbars are displayed. This is exactly how I want it to be. However, a problem occurs

WPF - setting HorizontalAlignment= Stretch to Textbox in StackPanel

旧巷老猫 提交于 2019-12-21 07:16:41
问题 Why doesn't a textbox stretch to fill space in a stackpanel? Is this by design? In a grid, the textbox stretches as expected. 回答1: Yes, it's by design. The StackPanel will allocate the space the TextBox asks for. If you haven't set a width on the TextBox , it will require only enough width to fit its text. 回答2: Kent's answer seems right. To still force override the StackPanel behavior, I think you'd need to dynamically compute-set the Width property of the contained elements OR some funky

WPF - setting HorizontalAlignment= Stretch to Textbox in StackPanel

元气小坏坏 提交于 2019-12-21 07:16:35
问题 Why doesn't a textbox stretch to fill space in a stackpanel? Is this by design? In a grid, the textbox stretches as expected. 回答1: Yes, it's by design. The StackPanel will allocate the space the TextBox asks for. If you haven't set a width on the TextBox , it will require only enough width to fit its text. 回答2: Kent's answer seems right. To still force override the StackPanel behavior, I think you'd need to dynamically compute-set the Width property of the contained elements OR some funky

autosize textarea in angular2

北城以北 提交于 2019-12-20 12:35:38
问题 I am working on angular2 applciation. i have a requirement to autosize textarea. I am trying to reuse the angular2-autosize from https://github.com/stevepapa/angular2-autosize Followed the readme, But I am getting the below error Uncaught Error: Module build failed: Error: ENOENT: no such file or directory, open 'C:\Users\Vipin\SampleApp\node_modules\angular2-autosize\angular2-autosize.js'. Please suggest how to overcome this issue. 回答1: Update (15.04.2018) Managed to package it, now its

WPF: How to auto-size WebBrowser inside a Popup?

*爱你&永不变心* 提交于 2019-12-20 03:12:05
问题 I have a Popup with a WebBrowser inside (see code below). The WebBrowser have MaxWidth = "800" . I want auto-size the height of WebBrowser to its content height after it load website, so it dont need vertical ScrollBar. I tried set Height = "Auto" or MaxHeight = "5000" , but I dont get right result. Can you help me how to do it? Thank you very much! <Popup Name="popup1" VerticalOffset="3"> <Border BorderThickness="1"> <DockPanel> <ScrollViewer MaxHeight="700" VerticalScrollBarVisibility="Auto

How do I configure a TextBox control to automatically resize itself vertically when text no longer fits on one line?

这一生的挚爱 提交于 2019-12-18 15:29:08
问题 How do I configure a TextBox control to automatically resize itself vertically when text no longer fits on one line? For example, in the following XAML: <DockPanel LastChildFill="True" Margin="0,0,0,0"> <Border Name="dataGridHeader" DataContext="{Binding Descriptor.Filter}" DockPanel.Dock="Top" BorderThickness="1" Style="{StaticResource ChamelionBorder}"> <Border Padding="5" BorderThickness="1,1,0,0" BorderBrush="{DynamicResource {ComponentResourceKey TypeInTargetAssembly=dc:NavigationPane,

How to get button content to fill width in WPF

☆樱花仙子☆ 提交于 2019-12-18 06:07:23
问题 In the following XAML the button will stretch to fit the width of the window, including as you resize the window. However, the TextBlock and blue box are centered. How would you change it so that: 1) the TextBlock is inside the Button, but left justified with the actual Button width (i.e. on the left side of the Window) 2) the Canvas is inside the Button, but right-justified with the actual Button width (i.e. on the right side of the Window) It seems "HorizontalAlignment=Stretch" doesn't work

Auto size text field with Actionscript 3

拜拜、爱过 提交于 2019-12-14 02:53:25
问题 I am not sure if this is possible, so, please, help me out a little bit over here: I have an image loaded into the stage: var miC:Loader = new Loader(); miC.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete); miC.load(new URLRequest("coverph.jpg")); function onComplete(e:Event):void { miC.width = stage.stageWidth; miC.height = stage.stageHeight; miC.x = 0; miC.y = 0; addChild(miC); trace(miC.width, miC.height); } And this way the image auto size itself to perfectly match the

Flowlayout panel and autosizing child controls doesn't work

怎甘沉沦 提交于 2019-12-13 14:27:18
问题 I am trying to get a very simple autosizing layout on a winform (C# .NET). I've tried TableLayoutPanels and FlowLayoutPanels but nothing works. I have a usercontrol which is a container for other usercontrols which are created at runtime - I've called it StackPanel as I want it to list the child controls vertically. I've tried this using a FlowLayoutPanel, TableLayoutPanel and a Panel (with each control docked to the top). The child usercontrol consists of a label and then any number of

iframe auto size based on content that changes size based on search results

泄露秘密 提交于 2019-12-13 06:20:02
问题 I have one page that contains search page iframe . If you try to search for a text it will rarely fit the page. I don't know what code to use to auto resize iframe based on content changes. Right now I use this code in iframe : <body onload="parent.alertsize(document.body.scrollHeight);"> And this javascript in parent page : <script> function alertsize(pixels){ pixels+=32; document.getElementById('my-iframe').style.height=pixels+"px"; } </script> 回答1: <script type="text/javascript"> var