autosize

How to set width to 100% in WPF

混江龙づ霸主 提交于 2019-11-29 20:50:05
Is there any way how to tell component in WPF to take 100% of available space? Like width: 100%; in CSS I've got this XAML, and I don't know how to force Grid to take 100% width. <ListBox Name="lstConnections"> <ListBox.ItemTemplate> <DataTemplate> <Grid Background="LightPink"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <TextBlock Grid.Row="0" Grid.Column="0" Text="{Binding Path=User}" Margin="4"></TextBlock>

Xcode Interface Builder. How Do These Autosizing Mask Settings Differ?

╄→гoц情女王★ 提交于 2019-11-29 19:06:19
问题 I am now quite comfortable using autosizing masks in IB but there are two autosizing setting that I am not clear how they are intended to differ: Setting 1 Autosizing with both upper and lower anchors http://dl.dropbox.com/u/11270323/stackoverflow/autosize-mask-0.png Setting 2 Autosizing with only uppper anchor http://dl.dropbox.com/u/11270323/stackoverflow/autosize-mask-1.png Some context. The UIView subclass that uses these settings is a child subview. Setting 1 is giving me the behavior I

SizeToContent equivalent for a WinForm?

断了今生、忘了曾经 提交于 2019-11-29 16:44:55
When playing with WPF, I discovered the SizeToContent method, which enables me to create dynamically the content of a window, and then have it automatically resized to fit its content. I try to do the same thing using WinForms, and it fails. I used the AutoSize and AutoSizeMode , but it fails to correctly size to its content. Is there a way to create a WinForm with controls that adjust to the size of their content, as in WPF? Thanks, As far as I remember this is a bit tricky in Windows Forms. Basically you need to use auto-sizing containers (e.g. TableLayoutPanel, etc. – and set their AutoSize

For Qt 4.6.x, how to auto-size text to fit in a specified width?

不羁岁月 提交于 2019-11-29 11:24:03
问题 Inside of my QGraphicsRectItem::paint(), I am trying to draw the name of the item within its rect(). However, for each of the different items, they can be of variable width and similarly names can be of variable length. Currently I am starting with a maximum font size, checking if it fits and decrementing it until I find a font size that fits. So far, I haven't been able to find a quick and easy way to do this. Is there a better, or more efficient way to do this? Thanks! void checkFontSize

Use Python to Write VBA Script?

烂漫一生 提交于 2019-11-29 10:36:35
问题 This might be a bit of a stretch, but is there a possibility that a python script can be used to create VBA in MS Excel (or any other MS Office product that uses VBA) using pythonwin or any other module. Where this idea came from was pythons openpyxl modules inability to do column autowidth. The script I have creates a workbook in memory and eventually saves it to disc. There are quite a few sheets and within each sheet, there are quite a few columns. I got to thinking....what if I just use

How to get button content to fill width in WPF

∥☆過路亽.° 提交于 2019-11-29 10:21:52
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 in this case, and, when using Auto sizing, the Grid inside the Button only ever grows to the minimum

WPF - How to stop TextBox from autosizing?

自作多情 提交于 2019-11-29 09:56:33
I have a textbox in my visual tree as follows.. Window Grid ListBox ItemTemplate DataTemplate Grid Grid Textbox ... The textbox is defined as.. <TextBox Height="Auto" Text="{Binding Path=LyricsForDisplay}" MinHeight="50" MaxHeight="400" Visibility="Visible" VerticalScrollBarVisibility="Auto" IsReadOnly="True" AllowDrop="False" TextWrapping="WrapWithOverflow"> </TextBox> When long text is added to the bound variable (LyricsForDisplay) all of the items in the listbox expand their textboxes/grids width's to allow for the entire string to be seen if you use the scrollbar on bottom that appears...

Autosizing EditText

本小妞迷上赌 提交于 2019-11-29 03:47:15
Android recently added the support for resizing TextViews text size based on the view size and the min and max text size. https://developer.android.com/guide/topics/ui/look-and-feel/autosizing-textview.html Unfortunately, they don't support EditTexts, so Is there any other alternatives for EditText? I was stuck as you, how EditText is child of TextView but don't support autosize ¿?¿? I have achieve this with some kind of hack. First I saw the TextView code to copy and implement as extension (in Kotlin) on EditTextView, but.. there is a bulk of methods, so endly I discard that option. What I

How to make DockPanel fill available space

情到浓时终转凉″ 提交于 2019-11-29 02:51:15
问题 I'm trying the content of a shopping cart in an ItemsControl(ListBox) . To do so, I've created the following DataTemplate : <DataTemplate x:Key="Templates.ShoppingCartProduct" DataType="{x:Type viewModel:ProductViewModel}"> <DockPanel HorizontalAlignment="Stretch"> <TextBlock DockPanel.Dock="Left" Text="{Binding Path=Name}" FontSize="10" Foreground="Black" /> <TextBlock DockPanel.Dock="Right" Text="{Binding Path=Price, StringFormat=\{0:C\}}" FontSize="10" Foreground="Black" /> </DockPanel> <

How to make scrollviewer work with Height set to Auto in WPF?

。_饼干妹妹 提交于 2019-11-28 23:22:30
I have learned that if the height of a grid row, where the ScrollViewer resides, is set as Auto , the vertical scroll bar will not take effect since the actual size of the ScrollViewer can be larger than the height in sight. So in order to make the scroll bar work, I should set the height to either a fixed number or star height However, I now have this requirement, that I have two different views reside in two grid rows, and I have a toggle button to switch between these two views: when one view is shown, the other one is hidden/disappeared. So I have defined two rows, both heights are set as