I'm designing an item template for a ListView but it is not shown on the designer.
I think that is because the ItemsSource is not set at the design-time, I set the ItemsSource at run-time only.
So is there a way to tell the designer emulate data for ItemsSource or whatever to show the preview?
Currently, I have to run the app to see the result or copy content of ItemTemplate to outside of ListView to see the preview then copy back later.
Guess I should have just put it as an answer.
In VS, right-click your ListView in the Document Outline and choose "Edit Template -> Edit Generated Items" or the same in Blend.
Then to toggle back out of there to your parent view hit the little icon in the top left corner of the document outline that looks like an upward pointing arrow on a bar
Related
If I have a Xaml Window open, I can goto Resources in the right panel, and see all my DataTemplates. If I right click on one of them, I can select a data template, click edit, then graphically edit my template.
Now that is nice, but, how do I go back to the Window containing the DataTemplate? If I right-click the window in the right hand panel, I can select "view xaml", but there is no option or menu I can find that returns me to the main Window for graphical editing. Where is it?!?
Anyone know how to return?
It's somewhere in the bar above the design view if i remember correctly, it's a path in the hierarchy which you can go up.
Also in the Objects and Timeline toolbar there's an up arrow which brings you back.
(Where it says DataTemplate1 (ContentPresenter Template))
Can the width of the dropdown be set to a different value than the AutoCompleteBox itself?
The Popup is a separate Part of the AutoCompleteBox, so it should be possible to extend that beyond the width of the text box.
In Blend, right-click on the AutoCompleteBox and select Edit Template > Edit a Copy, giving the new template a name.
Drill-down in the Objects and Timeline window to the 'Popup' part, and beneath that is a Grid. Change the width of that Grid to change the width of the popup content whilst maintaining the current width of the text box).
(I must admit I've only had chance to do this in Silverlight Spy, but it definitely works there so I can't see it being a problem doing it through Blend).
If you are not using Blend, just copy Default Style and Template of AutocompleteBox from MSDN and paste it into your App.xaml file (here is little tutorial on how to handle styles in app.xaml).
You can then modify that pasted style or template.
If I have a ListView embedded in a WinForm, is there any way I can simply click in the ListView and start typing in new items when the form is running?
At runtime, no. The only edit option it has is the LabelEdit property. Set it to true to allow the user to edit the ListViewItem.Text property of existing items.
In visual studio when you click on the listview a small triangle in the top right appears. When you click on it you can edit columns, etc.
I have a Silverlight form that contains a Stack Panel (orientation = vertical) with 10 rows. Each row contains a TextBlock and Textbox control except the last row has a TextBlock and Drowdown.. At the bottom of the control are two buttons. Previous & Continue.
There are 10 items in the Dropdown. When I select a value from the Dropdown, only two of the ten items are showing up. I believe that the remaining items aren't displying because there's some sort of clipping effect going on. Fair enough.
Does Silverlight allow the dropdown control to display upwards (instead of the default down direction)? Will I have to override some rendering capabiliities before the dropdown is rendered to the control or is there a property that allows me to accomplish this functionality?
The Silverlight ComboBox auto aligns the dropdown popup to always be visible whenever possible.
all Popup based controls (ComboBox, AutoCompleteBox, DatePicker and TimePicker) all have this feature enabled.
So if there's not enough screen real-estate below the ComboBox to show the dropdown popup, it'll show up above the control.
The combobox nesting in the visual tree should not affect the dropdown popup auto alignment. The internal Popup control (inside the ComboBox) ignores the Visual Tree and is nested "above" the visual tree.
If you have specific issues, please share minimal and relevant XAML. Since Keith is on this thread, I think it's safe to say he'll log a bug if needed.
I am confused with learning about WPF. I see ControlTemplate used to determine how each item in a listbox looks. Isn't that what the ItemTemplate is used for in listboxes? What is the difference?
A ControlTemplate let's you change the look&feel of existing controls, for example, make a normal everyday button look like Vista's taskbar shiny glass buttons or make a tab control look like the new Office 2007 ribbon.
The idea is that the control contains only the behavior and the ControlTemplate contains the look&feel - so a button is "something you click" not "a rectangle with some 3d effect you can click on".
You can replace the ListBox's control template to get something like a list box with rounded corners or custom scroll bars.
A DataTemplate (ItemTemplate is a property of type DataTemplate) on the other hand let's you control how the data rows displayed inside list boxes (and other similar controls), data templates are used to specify things like "Show last name, than a comma and the first name - and the last name should be bold and the first name should be green if it starts with an A".
And just for completeness there is also an ItemsPanelTemplate class that is used to change the internal layout of a list box - Charles Petzold's WPF book has an example of using it to make a normal list box display it's items in a circle.
An ItemTemplate describes how to render the data item in a listbox (for example, you might have your listbox bound to a List - the ItemTemplate will allow you to specify how to render a Foo). An ItemTemplate is a DataTemplate.
A ControlTemplate describes how the ListBox itself should be rendered