There is a very similar question already posted. In fact, the result of the answer in that post is exactly what I'm after, but I have no codebehind to place that code in. All of our logic is encapsulated in a ViewModel. Since the ViewModel is not supposed to have direct references to specific visual elements, this code cannot exist there...
Hi,
I have a slideshow application where i want to wait a certain amount of seconds, then show my front page, then wait again, then show next page, and so on. My problem is that when i use Thread.Sleep in between, the UI arent updated, it just sits there waiting and i only see my last control (after the full amount of time has passed (i....
Hello,
I have a TreeView that launches a new window when each of its TreeViewItems Selected event is raised.
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1"
Height="300"
Width="300">
<Gr...
I use DataTemplateSelector for ListView column headers template selection.
ListView itself is in DataTemplate and ends up in a few tabs. So, in practice, I have same DataTemplate (so ListView too) shared between more TabItems. This means that if I select tab {A} and set XDataTemplate on ListView column {AColumn}, if I switch the tab, le...
Hi,
I'm trying to change the content of a ContentPresenter to one of my View Model class. I manage to have it shown properly, once I change this content (property) from my model, it doesn't update the ui.
The following lines link my view model classes to their respective ui (setting their data context automatically) :
<DataTemplate...
I currently need to create a visual representation of a ferry system that displays the actual ferries their position on the sea and the state of their cargo. The ferries contain trucks and the trucks contain cars. I need to display the actual trucks and their xy postion on the deck. When the ferries are loaded the postions of the trucks ...
Behold the code below:
<Grid>
<TextBox>BOX</TextBox>
<TextBlock>block</TextBlock>
</Grid>
The words block and BOX are written over eacht other and no keyboard input is possible in the textbox.
Now consider this:
<Grid>
<TextBlock>block<TextBlock/>
<TextBox>BOX<TextBox/>
</Grid>
The TextBox covers th...
I need to bind a collection of strings inside a collection of strings to a DataGrid (Infragistics).
However, when I bind it like this:
<DataPresenter:XamDataGrid x:Name="xamDataGrid" DataSource="{Binding TheCollection}">
to either this:
public List<string[]> TheCollection
or this:
public List<List<string>> TheCollection
I get t...
Any suggestions how to go about having a XAML vector image as a Window background? There's plenty of code showing this with jpg's but I'd prefer a vector based image.
Having it as a resource would be a bonus too but I'm stumped as to the best approach.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation...
HI,
I have a XAML file where i have defined the UI elements.
In my code behind for the window, i add some uielements into one of the controls i have in the xaml file, and when I run it, it does not show up my control that i have added using the c# code.
For checking purposes, i tried to remove all controls i had setup via the XAML, in ...
Hi,
I have a WPF app that has a listbox. The drag mechanism is already implemented, but when the list is too long and I want to move an item to a position not visible I can't.
For example, the screen shows 10 items. And I have 20 items. If I want to drag the last item to the first position I must drag to the top and drop. Scroll up an...
I can set margins individually in code but how do I do it in XAML, e.g. how do I do this:
PSEUDO-CODE:
<StackPanel Margin.Top="{Binding TopMargin}">
...
I would like to have an animation when an item in ListView changes position, so it would slowly move to the new position. Either in a template or in code.
I've tried descending from a (Virtualizing)StackPanel and overriding ArrangeOverride to reposition and animate the items. the problem is that I don't know at what position the item was...
<Button IsEnabled="{Binding (Not IsDisabled)}" />
Is there a way to do it with pure xaml, or I will have to do it via code?
PS. I asked the question knowing that I can create a boolean converter like this:
<ValueConversion(GetType(Boolean), GetType(Boolean))>
Public Class BooleanFlagSwitchConverter : Implements IValueConverter
...
Hi
I want to set the UpdateSourceTrigger to an event of a control:
<TextBox Text="{Binding Field, UpdateSourceMode=btnOK.Click}">
<Button Name="btnOK">
<Button.Triggers>
<Trigger>
<!-- Update source -->
</Trigger>
</Button.Triggers>
</Button>
I thought about two ways:
Set UpdateSourceMode or some...
Hi!
I have a ListBox that each of its items has a button, I set all the textboxes in the dataitem that the Binding.UpdateSourceTrigger is Explicit.
I added a handler to the button's click, now what?
How do I collect the info from the controls? they don't have a key they are dynamic, how do I get their BindingExpressions?
<ListBox Ite...
What is the simplest way to bind a group of 3 radiobuttons to a property of type int for values 1, 2, or 3?
...
When creating a Navigation Application in WPF, How can I create a custom style and layout for the window? Is this possible?
Say for instance, adding a panel along the side of the window with links to all the pages in the application.
When I try add controls/content to the NavigationWindow, I get the following message:
"The type 'Navigat...
Hi,
I need to override the behaviour of XamlWriter when writing out a user control to file.
I have control which is just a grid with pictures in, the usercontrol has the grid and 4 properties which set the images.
When i use XamlWriter.Save it returns the inner xaml (which includes the grid etc) of the user control, however I just wa...
Hello all.
I want to use a Wpf RichTextBox to edit data and resave it to SQL field.
I need of course the text to be saved as rich text, not just simple text of course.
What data-type should be best for storing in SQL server (2005 - forget about file stream)?
How do I save/retrieve it?
...