Hello everyone,
As the title says, how should I go about animating the height or width of a Window? I can do something like:
var wdw = new Window();
var ani = new DoubleAnimation(wdw.Width + 150, TimeSpan.FromSeconds(0.2));
wdw.Show();
wdw.BeginAnimation(SomeDependencyProperty, ani)
...but Width doesn't seem to be a dependency prope...
I was looking at MEF as an extensibility framework, and I'm pretty much sold, except for one point:
Let's say I want to import both a ViewModel and a View to display it. I think the "right" way to do that is for the MEF part to export a ViewModel class, and a DataTemplate that displays the ViewModel. As an example, say you were buildi...
I've got a WCF service that passes around status updates via a struct like so:
[DataContract]
public struct StatusInfo
{
[DataMember] public int Total;
[DataMember] public string Authority;
}
...
public StatusInfo GetStatus() { ... }
I expose a property in a ViewModel like this:
public class ServiceViewModel : ViewModel
{
...
I'm having some trouble with setting up an ObjectDataProvider with custom method parameters.
For a start I have a ListBox which is bound to a custom List which is set up programmatically with ItemsSource property. Then i would like to SelectedItem to be a parameter to my custom method. So in XAML i have:
<ListBox /*omitted*/ Selection...
Hi,
I'm trying to get the position of a canvas from a mouse move handler but it returns NeuN.
The canvas is inside another canvas and the code is:
Console.WriteLine(Canvas.GetTop(canvas2));
this is inside:
private void move(object sender, MouseEventArgs e)
{
Console.WriteLine(Canvas.GetTop(canvas2));
}
I'd say it can't be a scope...
I have a listbox in my silverlight usercontrol and I am filling it with a generic list of a private class, for some reason it is not being databound.
Here is the code :
class userClient
{
public int characterID { get; set; }
public string characterName { get; set; }
}
List<userClient> userClientList; // = new List<userClient>...
I have a WPF windows where I want a section of at the top of the Window to be just the height of all the elements contained in it. The bottom section of the window should be be the adjustable height area. If the window made taller, then the bottom section should be the section that grows and not the top section.
Inside the bottom sect...
Hello,
I am attempting to set the background color for a list box in code. I can get it to work with the list box item, but not the list box itself.
Here is the code that works (with the ListBoxItem):
private void SetBackgroundGradient()
{
var styleListBox = new Style(typeof(ListBoxItem));
var myBrush = ne...
WPF allows a control library to provide different resource dictionaries for different system themes, essentially allowing an application to match the operating system's selected visual theme (Aero, Luna, etc).
I'm wondering if I can include multiple theme resource dictionaries with my application and utilise some existing theme support ...
I am experiencing an enormous memory leak in my WPF project and am trying to figure out what I can do to minimize it. To access resources I use StaticResource 100% of the time. Should I use DynamicResource where I can? Are there advantages as far as memory management between StaticResource and DynamicResource?
FYI: I have a listbox show...
I'm developing a project using the MVVM pattern in WPF.
One of the key benefits to MVVM is maintaining clear separation between business logic and presentation.
As a test to see how well separated everything actually was, over the weekend I spiked moving all ViewModels, Models, and business logic to a separate .dll. The .exe was left ...
I'm writing an app that lets users browse through data, and I want to use the FireFox UI style: allow the user to open as many windows as they want, each with as many tabs as they want. I also want to try to do this using the Model-View-ViewModel pattern as much as possible.
Opening a new tab should be easy enough to handle in MVVM. Mak...
In WPF, Can I use binding with values defined in Settings? If this is possible, please provide a sample.
...
I have a ListView WPF control with GridView which I'd like to resize the GridView columns, when the content of the columns changes. I have several distinct data sets but when I change from one to another, the size of each columns fits the previous data. I'd like to update dynamically. How can I do that?
...
I want to set a binding. The problem is that the target is of type string but the source is of type double.
In the following code VersionNumber is of type double. When I run this, the textblock is empty, without throwing any exceptions.
How can I set this binding?
<Style TargetType="{x:Type MyControl}">
<Setter Property="Template">
...
Hi
Suppose I have a view implemented as a DataTempate inside a resource Dictionary.
And I have a corresponding ViewModel.
Binding Commands are easy. But what if my View contains a control such as a ListBox, and I need to Publish an application wide event (Using Prism's Event Aggreagtor) based on the Item being Changed on the List.
if L...
I've got a grid defined simply:
<Grid Margin="0,5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"></ColumnDefinition>
<ColumnDefinition Width="50"></ColumnDefinition>
<ColumnDefinition Width="48"></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions>
Then I'm t...
Say I have a very simple UserControl that - for all intents and purposes - is nothing more than TextBox:
public partial class FooBox : UserControl
{
public static readonly DependencyProperty FooTextProperty =
DependencyProperty.Register("FooText", typeof(string), typeof(FooBox));
public FooBox()
{
Initialize...
I have this DependencyProperty which holds an entity with a property that is a collection (ShoutBox.Entities):
public static readonly DependencyProperty ShoutBoxProperty = DependencyProperty.Register("ShoutBox",typeof (ShoutBox),typeof (ShoutBoxViewerControl));
public ShoutBox ShoutBox
{
get { return (ShoutBox) GetValue(ShoutBoxPro...
I have a custom control I'm developing that has a collection of items. When adding an item to the collection you're meant to do:
myCustomControl.BeginAddItems();
myCustomControl.Items.Add("a");
myCustomControl.Items.Add("b");
myCustomControl.Items.Add("c");
myCustomControl.EndAddItems();
If defining in xaml it would be:
<MyCont...