stackpanel

Need a “grid” of stackpanels to be used as a calendar

霸气de小男生 提交于 2019-12-11 11:22:42
问题 Ultimately, my aim is to have a grid (by grid I mean rows and columns, however it's achieved) of small stack panels to represent time intervals throughout a day. Not too disimilar from the following I suppose (simple calendar-type layout on the right): (source: msdn.com) I need a way of creating this grid dynamically and naming the panels appropriately for whenever an event is fired (to be specific - a drop event, each panel's drop event will be wired to the same method in which I must

How to set items order in StackPanel

梦想的初衷 提交于 2019-12-11 11:15:39
问题 I have a List of string. e.g. "abc", "pqr", "xyz" in this order. A StackPanel is data bound to this list. I want to display the list in a StackPanel vertically but in reverse order from top to bottom "xyz" "pqr" "abc" Is there a way to do this in xaml or do I have to reorder my list? 回答1: Yes and No, the StackPanel will display them in the order in which they are enumerated. So you have a couple of options as I see it: 1) Re-order your list 2) Change your binding, or apply a IValueConverter

How to scroll the datagrid in stackpanel?

99封情书 提交于 2019-12-11 08:45:51
问题 I want to scroll the datagrid when it's length exceeds the stackpanel , so I tried this: <StackPanel Orientation="Horizontal"> <ScrollViewer VerticalScrollBarVisibility="Auto" CanContentScroll="True"> <DataGrid Name="dgConfig" VerticalAlignment="Stretch" AutoGenerateColumns="False"> <DataGrid.Columns> ... </DataGrid.Columns> </DataGrid> </ScrollViewer> </StackPanel> But this doesn't work, I have searched on this web and failed to find any avaiable solutions. So how should I fix this? Thanks!

TextBlock not wrapping inside grid column windows phone

倾然丶 夕夏残阳落幕 提交于 2019-12-11 08:33:24
问题 I've the following xaml definition. The textblock inside the stackpanel is not wrapping. <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <Grid.RowDefinitions> <RowDefinition Height="auto" /> <RowDefinition Height="auto" /> <RowDefinition Height="auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <toolkit:PhoneTextBox x:Name="NotesText" Grid.Row="0" Grid.ColumnSpan="2" Hint="Add Notes"

Displaying a data-bound StackPanel inside a DataTemplate

本秂侑毒 提交于 2019-12-11 05:30:36
问题 I have objects I'm databinding to a ListBox in WPF. Here's what the end result should look like: ------------------------------- | Name | Opt1 | Value1 | | | Opt2 | Value2 | | | Opt3 | Value3 | | | Opt4 | Value4 | ------------------------------- Essentially i've got a DataTemplate for the overall variable, and then the Opt/Value combo has it's own DataTemplate. I'm trying to display the list of values as simply as possible. <Label Content="{Binding Path=Identifier.Name, Mode=OneWay}" />

Loop through stackPanel.children genericaly

感情迁移 提交于 2019-12-11 04:44:34
问题 In code I am dynamically adding controls (e.g. TextBox, ComboBox, Label, etc) that I would like to now loop through and get the values from each applicable (e.g. not Labels) control that a user inputted data for. foreach (Control control in EditForm.Children) { values = new List<string>(); fieldName = control.Name; if (control is ComboBox) { ComboBox cmb = control as ComboBox; string value = cmb.SelectedValue.ToString(); } } The problem is that I get an error during runtime of Unable to cast

How to use code-behind to create StackPanel -> Border -> Background

隐身守侯 提交于 2019-12-10 17:09:19
问题 I'm trying to set properties of a TreeViewItem -> StackPanel in c# like this question. It seems to make a lot of sense until I get to the part where I try to edit the Background in my Border . Borders have Background objects in them, but for the life of me I can't set a color or anything. It seems to be inconsistent because I can add Content to a Label by simply saying, Content = "Title" . Anyway, this is my code: public static TreeViewItem childNode = new TreeViewItem() //Child Node { Header

WPF StackPanel controls order

独自空忆成欢 提交于 2019-12-10 15:53:18
问题 Is there a way to change the order of the controls inside a StackPanel at runtime? Many thanks, Paulo 回答1: stackPanel1.Children.Remove(item); stackPanel1.Children.Insert(newIndex, item); 来源: https://stackoverflow.com/questions/1398548/wpf-stackpanel-controls-order

How can I add a FlowDocument to a StackPanel?

做~自己de王妃 提交于 2019-12-10 15:26:29
问题 I created the following class in order to have an easy way to display formatted text in a WPF document. However this solution returns a FlowDocument , and I am having trouble integrating this FlowDocument in my current application in which I was simply adding TextBlocks to StackPanels and WrapPanels and Borders, etc. How can I add the FlowDocument objects that I create to my existing StackPanels, Borders, and WrapPanels? alt text http://www.deviantsart.com/upload/11jt33i.png using System

How to implement a click event for a stackpanel

给你一囗甜甜゛ 提交于 2019-12-10 14:14:55
问题 I checked the stackpanel class here http://msdn.microsoft.com/en-us/library/system.windows.controls.stackpanel.aspx and it has no click event. I'm working on a windows phone 8 app and I've got a textbox and some buttons on a stack panel. I want to include a feature where the stackpanel can be clicked then the visibility of the controls on it are set to collapsed, and then when clicked again they become visible. How do I do this? 回答1: You can solve this problem in a little tricky manner, if it