wpf

WPF "Selected" Property of Custom Control or "Logical Focus". What should be used?

In my WPF project I have a custom control which is visually represented by a rectangle object. In XAML I put a number of rectangles based on this custom control. User should be able to select a group of these rectangles by mouse clicks and then do some actions with these selected rectangles. How I should implement the possibility of sel...

MVVM Command Binding

I'm trying to learn the MVVM pattern. The main problem I'm having is learning where I should be declaring, creating and binding command objects. 2 examples: I have a main form that acts like a switch board or main menu. Selct button 1 and View 1 is displayed, Select button 2 and view 2 is displayed. Great. Now I want to go back to...

Running a WPF User control or Managed Directx control on JFrame

If I have developed a user control as mentioned in the tile and I use this http://www.ikvm.net/ to convert my .dll to a Jar file, Can I then embed that control on my JFrame? If so can you give an example please. ...

How to hook hotkeys in winforms or WPF from a .NET 2.0 assembly?

I have assembly that targets .NET 2.0 to be compatible with a broad range of applications. When used with a desktop application (either winforms or WPF) I want to hook certain hotkeys and popup modeless dialog windows. The tricky bit is finding a solution that can be implemented under .NET 2.0 that is compatible with WPF. For winforms...

Is this WPF ProgressBar Odd render behaviour a Bug?

Hope someone can help. I have a simple scenario where clicking checkboxes is driving a progress bar in WPF. The checkboxes are contained in a UserControl and the Progress bar is in a simple WPF client window. On the user control I am using two dependency properties: 1) the existing Tag property has the value I wish to bind to the progres...

WPF: Can I put a colour animation in a style?

This is a simple WPF window in XAML: <Window x:Class="AnimateTest.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" x:Name="MainWindow" Style="{StaticResource TestStyle}"> <Grid> </...

Where should be put XAML for layout of custom control in WPF?

After custom control is created there automatically appeared file for C# code - MyCustomControl.cs: public class MyCustomControl : ContentControl { static MyCustomControl( ) { ... DefaultStyleKeyProperty.OverrideMetadata(typeof(MyCustomControl), new FrameworkPropertyMetadata(typeof(MyCustomControl))); }...

Rich client choice for an intranet web application with 5000+ users

For an intranet web application with 5000+ users we need to develop highly interactive (as few postbacks as possible) client. So performance issue might arise. What would be your choice and why? - ASP.NET Web Forms + JQuery/Ajax - ASP.NET Web Forms + Silverlight - ASP.NET MVC + JQuery/Ajax - ASP.NET MVC + Silverlight - WPF ...

WPF sluggish rendering/animation performance?

I've been trying to animate around 1000 lines which are all added to a Canvas, and it is extremely slow to the extend that animation is not feasible at all. At first I thought it was probably because of all the calculations, but then I tried a very simple experiment. I generated around 1000 random lines and I tried to move them to new r...

UIelement position relative to Window

Hi In WPF, I want to get the corner location of a TabControl in my code, so I can set a ToolWindow's location accordingly when shown. How do I get the location of a given UIElement ? buildingInfoWindow = new BuildingInfoWindow(); // BuildingWindow : System.Windows.Window buildingInfoWindow.Owner = this; //buildingInfoWindow.Left = ?;...

wpf treeview mvvm

hi I am trying to populate a treeview using mvvm but the tree does not display any data. I have a Employee list which is a property in my vm which contains he employee data. the xaml is as follows. <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="FontWeight" Value="Norma...

How to define stroke around background rectangle of textblock in WPF?

I would like to have some text to be inside a rectangle with stroke around this rectangle (just like property "Stroke" of the object "Rectangle" itself). But I didn't manage to find a property of the object "Textblock" wich defines such a stroke. ...

How to set RichTextBox Font for the next text to be written?

Hi, I need to set the font family for the next text to be written in a RichTextBox. I tried setting that with... <RichTextBox x:Name="RichTextEditor" MaxWidth="1000" SpellCheck.IsEnabled="True" FontFamily="{Binding ElementName=TextFontComboBox, Path=SelectedItem}" FontSize="{Binding ElementName=TextSizeComboBox...

Binding of TextBlock inside Custom Control to dependency property of the same Custom Control

I have a custom control with a TextBlock inside it: <Style TargetType="{x:Type local:CustControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:CustControl}"> <Border Background="Blue" Height="26" Width="26...

wpf visual studio designer won't load user controls

Hello The view below is a container for three user controls, and I started getting this error after refactoring application resources: Error 295 Could not create an instance of type 'FilterPanel'. C:...\ProjectPickerWindow.xaml Here is the xaml for the view: <Window x:Class="Smack.ConstructionAdmin.WpfPresentation.Views.ProjectPic...

WPF: Scrolling Doesn't Update in FlowDocumentScrollViewer Placed in TabControl if the Tab is Inactive

I'm working on a chat client using the .NET Framework 3.5 and WPF. I use a TabControl to handle multiple chat windows. Inside each tab, I use a FlowDocumentScrollViewer to display the chat log. When content is added to the chat log, I call ScrollToBottom() on the ScrollViewer (unless the user has moved the scroll bar away from the bot...

How I should reference Custom Control in C# code behind file event trigger?

In Xaml page I reference my custom control this way: <MyNamespace:CustControl x:Name="Cust1" /> Now I want change the property of this custom control in MouseLeftButtonDown event trigger: private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { } But when I try to write something like CustControl.Is...

XAML Treeview, how to displayed nodes horizontally instead of vertically

I'm kinda new at XAML and I'm trying to figure how to display the TreeView nodes horizontally instead of vertically, i.e Header 1 Item 1 Item 2 item 3 Header 2 Item 4 Instead of Header 1 Item 1 Item 2 Item 3 Header 2 Item 4 It's not really as simple as it seems, I was able to get the headers to go horizontally thou...

How in WPF C# code-behined file to assign a property from predefined set of values?

In my WPF project I have a custom control with some properties assigned, they are of "string" and "bool" types. Something like: public class CustControl : Control { static CustControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(CustControl), new FrameworkPropertyMetadata(typeof(CustControl))); } public ...

Implementing a audio visualizer in WPF

I wish to implement a audio visualizer widget (similar to what Winamp has) in WPF. How would I approach this problem? ...