wpf

adding custom routed event of user control to xaml of a window in wpf

Hi Experts, I am little new to Command binding so this might be a trivial question to many. I know that we can add Command bindings in xaml of a window and give its correspondng property in viewmodel. This viewmodel will be given to the DataContext of the window. Something like the following --app.xaml.cs mainWindow.DataContext = view...

How to inherit/extend styles from a resource dictionary?

I am having trouble extending one of my styles that I have defined in the Windows dictionary. Alone, it seems to apply the style to my controls as expected. However, if try to extend the style in one of my userControls, using the basedOn property, it simply overrides the main one and all the base styles dissapear. Here's an example: ...

How do I set the height of a wpf slider control's thumb ...

I want to put a slider in a datagrid cell and the row has a height of 20, so i'd like to make the height of the thumb of the slider smaller than that. I set the height of the slider itself, but the thumb appears to be cut off (i.e. it doesn't scale down to the height that I specify in the slider.height property). I don't want to have to ...

Json issue in a sub-class

I have 2 DTO files, with one of them being a sub-class of the other. The fields on the super-class are as follows: [JsonProperty] protected int financialFormatHeaderID; [JsonProperty] protected string financialFormatHeaderCode; [JsonProperty] protected string description = string.Empty; [JsonProperty] protected FinancialFormatPurpose...

Big delay in debug mode on application start when custom splash is defined In Visual Studio 2010. WPF application.

Hi, I have a very strange problem, that seems like a Visual Studio 2010 bug. I have Windows 7 OS. Framework 3.5, VS 2010. I have a simple splash, defined in property of some image. I run in debug mode WPF application, that is used NHibernate and ActiveRecord (unmanaged code). The application is freezes for some time (depends of amount...

Add a WPF UserControl to a TaskPane

I am developing an addin to Microsoft Outlook. The following code works fine if I use an winforms UserControl: private void ThisAddIn_Startup(object sender, System.EventArgs e) { var testControlView1 = new UserControl1(); var MyCustomPane = this.CustomTaskPanes.Add(testControlView, "Hello"); } How can I do it with...

Handling print screen when focus has been lost

I have a text box on a form that is incremented each time an alt and print screen key are pressed, and specifically on the up of the print screen key. This all works fine. But what I need to accomplish is to keep that happening even when the focus has changed. Below is my code so far: I have been told to create a hook for this as it's ou...

ObservableCollection auto-index

I've got a list of items that I'm placing in an ObservableCollection which I am then databinding to a datagrid UI created in XAML. One of the columns displayed is the index of the item in the list. Currently, I am creating a property and binding to it. However, this creates a lot of work when I need to update/add/remove items from the li...

MultiBinding with Prism/RibbonControl causing converter to fire early

<inf:WorkspaceContent.Resources> <ResourceDictionary> <commands:CommandReference x:Key="CompareCommandReference" Command="{Binding CompareCommand}"/> <converters:FlowDocumentConverter x:Key="FlowDocConverter"/> </ResourceDictionary> </inf:WorkspaceContent.Resources> <Grid x:Name="LayoutRoot"> <Grid.RowDef...

Vertical Scroll in stackpanel

I am trying to get a scroll bar to be placed on a stack panel. The scroll bar displays but will not allow for the user to move the scroll bar at all. Is there something wrong with my XMAL or is there more to it? <GroupBox HorizontalAlignment="Left" Margin="268,8,0,0" VerticalAlignment="Top" Width="505.881" Height="352.653" Header="Metr...

How can I create WPF Window in BackgroundWorker?

Hello guys! Can anybody explain me, how can I create WPF Window in BackgroundWorker thread without errors? I have some class (WPF Window): public partial class Captcha : Window { public Captcha() { InitializeComponent(); } private void SendCaptchaBtn_Click(object sender, RoutedEventArgs ...

page.DataContext not inherited from parent Frame?

I have a Page page in a Frame frame, with frame.DataContext = "foo". (page.Parent as Frame).DataContext is "foo". ok BindingExpression for page.DataContext is null (also forced with ClearValue). ok page.DataContext is null. but I expected "foo"! Why isn't the DataContext inherited? As far as I understand the Frame sandboxes the conte...

Is storing info in unrelated attached properties a code smell?

I was just watching a "how-to" type WPF video called How Do I: Use Attached Properties to Store Extra Data in WPF, and it was describing what to do when you want to associate two pieces of information with a single control. If you want to put one piece of information in, they say to use the Tag property. <Grid> <TextBox Tag="innerD...

WPF DataGrid selecting disabled

In VS 2010/.NET 4.0, I have a List<MyClass> list of a simple class as such: public class MyClass { public string String1 { get; set; } public string String2 { get; set; } public MyClass(string string1, string string2) { String1 = string1; String2 = string2; } } This list is displayed in a W...

WPF button with Focusable=False does not refresh if covered over by dialog opened in click event handler

I've noticed an odd behavior with WPF where a button that has the Focusable property set to false will fail to refresh its visual state if the button is occluded by a popup (ex: a file dialog). On to the good stuff, here is a minimal code example: XAML <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/wi...

Update DataGrid bound to DataTable after DataTable is altered WPF

I have a combobox where the user can select a particular year (populated by the database) and view particular information for the year. That information is stored in a datatable which is bound to a datagrid. I want it to recreate the data grid when I change the year. _PropertyTenantData is a DataTable that has 14 columns Property Id, Pr...

Indentation in WPF TextFormatter

Hi everybody! I'm making a WPF text-editor using TextFormatter. I need to indent some paragraphs, so I'm using the Indent property from the TextParagraphProperties class. This works great in this scenario: Regular text without any indentation.     This paragraph has a uniform     indentation so everything is     ok. But I also need th...

WPF skin library that works in Visual Studio 2008 Designer

In our projects, we have views and controls that are in many different assemblies (upwards of 40 assemblies in a single solution with 100s of views). We would like to apply a skin to all views from a single skin assembly that we can swap out with a different skin assembly to apply a different skin (not necessarily at runtime, this could...

Binding Label content to Self string field but no result

I'm trying what should be an easy bind in my user control: <UserControl x:Class="MyApp.FlowNode" ...> <StackPanel> <Label Content="{Binding Path=Header, RelativeSource={RelativeSource Self}}" /> </StackPanel> </UserControl> With the underlying code being: public partial class FlowNode : UserControl { public FlowNo...

What do you think of the DynamicViewModel class?

A few weeks ago, I came across this article in MSDN magazine which talks about MVVM in general. One of the things that stood out to me was the DynamicViewModel class. It addresses the code-duplication problem common to applications using the MVVM pattern. So I wonder, has anyone else tried using it? What do you think of it? See, as...