I am working on a wpf application, when using Combo Box control i am assigning ItemsSource to it. So, it displays a list of items with no item selected, now user can select an item of his choice. When user has made a selection he has no option to undo that. I want him to be able to get the initial state where no item is selected. How can...
In my WPF application, I have a Canvas object that contains some UserControl objects.
I wish to animate the UserControl objects within the Canvas using DoubleAnimation so that they go from the right of the Canvas to the left of the Canvas. This is how I have done it so far (by passing the UserControl objects into the function):
pri...
I'm following the example here of binding a MenuItem to a data object.
<Menu Grid.Row="0" KeyboardNavigation.TabNavigation="Cycle" ItemsSource="{Binding Path=MenuCommands}">
<Menu.ItemContainerStyle>
<Style>
<Setter Property="MenuItem.Header" Value="{Binding Path=DisplayName}"/>
...
I am developing a WPF application, and have a TextBlock which I want to use command binding to trigger a command on when clicked. What's the best way to achieve this?
The TextBlock-control does not have a Command property, but it does have a CommandManager. What is this? Can it be used for command bindings? I've seen many other contro...
Hi!
While learning c# and wpf, i am trying to get grasp of data binding. So far unsuccessful. All the help i could find on the net, even if described as "for beginners", is too complicated for me to begin to understand. I would appreciate if someone can provide a code for binding in a very simple example:
namespace BindingTest
{
cl...
Hi all
I have a weird problem with datagrid. I have a list with 2 items, inside every item there is a ListCollectionView.
A datagrid is binded to the selected item's ListCollectionView.
if I add (in code) a sort description to the selected item's ListCollectionView ,select item 2 and then select item 1 again the ListCollectionView so...
How can I see the sort button & direction per column in my datagrid?
Or even better, how can I see a seperator between the column headers?
here's my grid code:
<Window.Resources>
<Style x:Key="HeaderTextStyle" TargetType="{x:Type dg:DataGridColumnHeader}">
<Setter Property="Background" Value="DarkSlateGray" />
<Set...
OK, this must be a duplicate question, but I cannot find the answer:
I have a listbox that is databound to a Collection. By default Items[0] is selected. How can I prevent this in order to ensure that the SelectionChanged event is raised any time I click a ListBoxItem?
EDIT:
I had already dismissed the SelectedIndex=-1 route, but I trie...
Having some layout frustrations in WPF- I'm using a ToolBar to house a set of controls, most of which are Buttons and one of which is (going to be) some sort of dropdown menu. In WinForms, the ToolStripDropDownButton was perfect; however, I can't seem to figure out the best way to replicate this behavior in WPF.
Any ideas?
...
Hello, I have ListBox and want to put values in this listbox from DataTable:
listBoxVisibleFields.DataContext = SelectedFields;
Where SelectedFields is a DataTable filled with data. But this code does not work. My listbox is empty. As i remember, in WinForms was sucha a thing for list box like ValueMember and DisplayMember, but in WPF...
What can I do if I want to have a text-box representing in real time the value of a loop counter in wpf?
appending working solution:
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private delegate void UpdateTextBox(DependencyProperty dp, Object value);
...
private void MyMe...
I know similar questions exists but they don't address this exact problem.
I'm having an issue with Visual Studio 2008 SP1 whereby it hangs for 4-10 seconds whenever the xaml edit receives focus. It is literally driving me to despair and I'm about to move back to Winforms. Note - Just editing the straight up xaml (i.e no designer enable...
Hi,
How can i get the listbox item to stretch the entire height of the listbox when it is selected.My situation is like my listboxitem contains an expander which expands and shows another list.The second listbox is quite long and i am looking for some way to prevent the user from scrolling a lot.I am looking for some way to give the seco...
Given this piece of XAML
<DockPanel>
<DockPanel.Resources>
<Style TargetType="{x:Type GroupBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupBox}">
<DockPanel>
<Border DockPanel.Dock="Top">
<Border.Resources>
...
I work almost exclusively in Release mode since debugging it is good enough for the rare times I need to debug. I've recently started trying to use Expression Blend 3 for my xaml, but it seems to only work with the debug version of my project. Is there any way to change this?
I'd really like to avoid having to build everything debug...
I've said it before and I'll say it again, the easiest examples for WPF are also the hardest to find on the web :)
I have a combo box that I need to display but it doesn't need to be databound or anything else, the content is static. How can I add a static list of items to my combo box using XAML?
...
I am trying to create a custom Output Window for my software that is bound to my ViewModel. Usually in the past I have always used a TextBox and used the appendText() method to write to the Output Window. Of course with a ViewModel and trying to bind to a Textbox, it seems you can only Bind to the Text property. Below is what I am trying...
Hi,
I'm in the process of moving my application from .NET 3.5 to .NET 4.0, and I get the following error message : "Can't put a page in a Style". I've implemented the MVVM pattern for this application and use Data Templates to tell the application how to render my various view models...for example below.
<DataTemplate DataType="{x:Typ...
Hello,
I'm trying to create a custom, in-house application that is going to access other internal systems which broadcast their names and IP addresses via UDP. I'm trying to create a multi-threaded dialog that polls for UDP messages every 500 ms for 15 seconds, parses the UDP messages and then adds the names of the detected systems to ...
I have got an Indexer property in a Class called X, suppose X[Y] gives me a another object of Type Z
<ContentControl Content="{Binding X[Y]}" ...???
How can I make a DataBinding happens inside indexer? It works if I do {Binding [0]} . But {Binding X[Y]} just takes the indexer parameter as a string which is "Y"
Update :
Converter i...