I'm creating my own UserControl and I have two different DataTemplates under the UserControl.Resources section in my XAML. I want to choose between these two datatemplates depending on the value of a property on objects displayed in a listview. I do this by creating a custom DataTemplateSelector class and overriding the SelectTemplate me...
Specific scenario. ControlA changes a value that causes ControlB (a subclass of scrollviewer) to refigure it's viewport, offset, and extent, and then fire the ScrollableChanged event. ControlB also catches the "ScrollableChanged" event and is programatically scrolled to a determined offset. This creates this awful double redraw that w...
Well the problem is that I have this enum, BUT I don't want the combobox to show the values of the enum. This is the enum:
public enum Mode
{
[Description("Display active only")]
Active,
[Description("Display selected only")]
Selected,
[Description("Display active and selected")]
ActiveAndSelected
}...
I'm using the toolkit:DataGrid from CodePlex.
I'm generating the columns in code.
How can I set the equivalent of {Binding FirstName} in code?
Or alternatively, how can I just set the value, that's all I need to do, not necessarily bind it. I just want the value from my model property in the cell in the datagrid.
DataGridTextColumn d...
Hi,
I'm loading a XAML file with XamlReader and setting the returning object to the window's Content property. While this seems to work well, it doesn't quite do what I expect. If the window's original XAML contains keybindings or buttons, they seem to still exist. Keybindings still work and any Button objects in code are still valid. I...
Hello!
I'm using WPF within Visual Studio 2008. I have a simple WPF UserControl with the following code:
public partial class UserControl1 : UserControl
{
public UserControl1()
{
InitializeComponent();
Composite = new Composite();
}
protected override void OnRender(DrawingContext drawingContext)
{
...
Can I use a trigger on the SelectedItem property in any control that supports SelectedItem?
<Trigger
Property="SelectedItem"
Value="{x:NotNull}" >
</Trigger>
What I want is when the SelectedItem is Not null for the trigger to fire.
Tnx
...
I've been doing localization for my WPF application by storing strings in .resx files. My default (english) string resource is strings.resx. For other languages are called strings.fr-FR.resx for French, strings.es-ES.resx for Spanish and so on.
This method of localization has been great as my app will automatically load up the right str...
Hi,
I've been playing with WPF and I'm not sure what I'm trying to do is possible. So is it possible to have a usercontrol describing a tabitem? I've tried but without success.
Right now I use user controls for the content but I would like to change that to be more generic.
...
Hi,
In my MVVM application, I have a Direct3d render window that shows a bunch of 3d meshes in a scene. In that render window, I want to be able to click on one of those 3d meshes in the scene and move it around, having it follow the mouse cursor. This is typical 3d editor stuff, moving a mesh along in screen space. So I need to be able...
I have several bookmarked, but only have so much time in a day to read/study blogs. If I were to pick three blogs to read on a daily basis for deep understanding of WPF what should I read?
...
In WPF I have a Grid with a number of columns defined and the Width of each column is bound to the width of a DataGrid column, like so:
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{Binding ElementName=dataGrid, Path=RowHeaderWidth}" />
<ColumnDefinition Width="{Binding ElementName=Column0, Path=ActualWidth}" />
<ColumnDef...
WinForms has given way to WPF and new models such as MVVM, that better enable Test Driven Development, work very nicely with WPF. Also, it seems to me that ASP.NET is very closely aligned with the WinForms way of doing things, for example event handlers in the code-behind which is linked using inheritance or partial classes. With WPF a...
For some reason I'm really struggling with this. I'm new to wpf and I can't seem to find the information I need to understand this simple problem.
I am trying to bind a textbox to a string, the output of the programs activity. I created a property for the string, but when the property changes, the textbox does not. I had this problem w...
I am developing an application in wpf. I already created a treeview like vista.Now i want to open my Default My Pictures folder when i load the treeview. I am getting treeview like
Desktop-->C:\ D:... Now i want to show My Pictures under Desktop. Is there any way to do that. Suggestions plz.
Thanks in advance.
...
Most list boxes allow you to find items within them by typing the first letters of the displayed text. If the typed letters match multiple items, then you can keep adding letters to narrow the search.
I need to do this in a WPF ListBox. However, the items aren't plain strings -- they're custom objects that I present using a DataTempla...
In my view, I've implemented a the WPF DataGrid from CodePlex:
<toolkit:DataGrid x:Name="CodePlexDataGrid"
Style="{StaticResource ToolkitDataGrid}"
ItemsSource="{Binding Customers}"/>
It is bound to an ObservableCollection in my ViewModel:
private ObservableCollection<Customer> _customers;
public ObservableCollection<Custom...
Hello,
I'm working on a ListBox that overrides its' ItemsPanelTemplate to use a Canvas instead of a StackPanel. ListBoxItems have a DataTemplate that uses a converter to define the look and position of each ListBoxItem on the canvas. When I add an item to the collection that the ListBox is bound to, I'd like to be able to add other UI...
In my View, I have a button.
When the user clicks this button, I want to have the ViewModel save the context of the TextBlock in the database.
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top">
<TextBlock Text="{Binding FirstName}"/>
<TextBox Text="Save this text to the database."/>
<Button Content="Save" Comma...
I understand that in the MVVM pattern, that a ViewModel should know nothing about the View.
So there seems to be two ways that the ViewModel can cause something particular to happen on the UI, consider this common flow of events:
user types something in a textbox
user clicks button
button calls DelegateCommand called "Save" on viewmod...