wpf

Why TabControl.SelectedContent != (TabControl.SelectedItem as TabItem).Content ?

The following sample shouldn't beep (in my opinion) but it does. Why? Does that mean the SelectedContent property is useless? Is it a bug in WPF? <TabControl SelectionChanged="TabControl_SelectionChanged"> <TabItem Header="Tab 1"> <Grid/> </TabItem> <TabItem Header="Tab 2"> <Grid/> </TabItem> </TabControl...

WPF: how to get remaining width in a StackPanel?

Hi, Given the code below: <Window x:Class="Window3" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window3" Height="300" Width="300"> <StackPanel Background="Yellow" Orientation="Horizontal"> <TextBlock Background="Green" Text="some...

DRM for videos bundled with a desktop app?

Hey everybody, So, I have this desktop app built using WPF and C#. It's basically an offline course system that has videos, quizzes, and other assorted content. My dilemma is that I don't know how to protect the videos once they are downloaded and installed on the users machine? Are there any DRM systems out there that I can look into? ...

Weird behaviour in Drag drop

Im using drag drop to treeView items in a tree in a WPF application. There is some unexpected behaviour when I drag a node from the bottom edge and drag it to some other node. The node that I drag is not getting moved, but the node immediately below it is. Please let me know if you have any thoughts on this or experienced this before. Th...

Why can't I Bind a viewmodel property to a dependency property of a custom control

I want to use a color picker in my wpf application and I saw a nice looking one on this codeproject page. The control works fine until I want to connect the control to a viewmodel. I created a small test program with this viewmodel: public class ColorViewModel : ViewModelBase { public ColorViewModel() { LineColor = Brush...

WPF/SL EventAggregator implementation with durable subscribers behavior?

Hi. Currently I'm building an application using latest Prism for Silverlight 4. I've a module and in that module I've two views with view models. Also I've a module view with two regions for each view. In module initialization I'm registering my views and view models in Unity container and also register views with corresponding regions. ...

Increase the spacing between TreeViewItems in a TreeView

Im working with a TreeView in WPF. What I have is :- TreeRoot -TreeViewItem1 -TreeViewItem2 -TreeViewItem3 -TreeViewItem4 What I want is TreeRoot -TreeViewItem1 -TreeViewItem2 -TreeViewItem3 -TreeViewItem4 So, Is there a way to increase the spacing between the TreeViewItems ...

how to bind multiple value in WPF ??

hai am using the below binding to bind my value 'Name' to textblock1. <TextBlock Text="{Binding Name}" /> now the problem is i want to bind another value called 'ID' with that same textblock1 is it possible to bind value like using Name + ID like that??? :) ...

Draw or create databound UserControls dynamically at runtime in WPF

I'm trying to createa time-tracking application in WPF. The user is supposed to draw elements that represent a timespan (timespan = bar) onto a Canvas. Now, exisiting bars are added when they are databound to a collection (each collection item contains the width and left position of the bar on the Canvas). The 'bar' Usercontrol has a de...

WPF RichTextBox - Selected Block?

I am experimenting with the WPF RichTextBox and notice that I can itterate through the blocks that make up its document by looping through RichTextBox.Document.Blocks. What is the best way to get the Block that surrounds the caret? I can get the CaretPosition and the ElementStart and ElementEnd properties of each block but can't see ho...

Need advice on organizing two WPF applications within one Visual Studio solution

I have a WPF application (KaleidoscopeApplication) organized as follows: Solution (6 projects) Cryptography (DLL) Rfid (DLL) KaleidoscopeApplication (buildable "startup project") Basically, KaleidoscopeApplication contains a bunch of resources (sounds, images, etc) and your standard WPF junk (App.xaml, App.xaml.cs, other xaml and c...

WPF datagrid bind to previous row's cell

Hi, I have a datagrid and one of the columns is going to be a checkbox column. To give the background, the checkbox is going to turn something on / off and each row in the datagrid is going to be for a differernt time (in time order, ascending). Is it possible for one row's checkbox to be bound to the state of the previous row? That wa...

The best WPF open source projects you've seen

Hi I'm so impressed by hanselman 's metholodgie ,However he all the time saying "read the code to learn" and I found this way very very cool That's why ,I'd like to make a cool appilication with C#/WPF but I don't know from where can I begin I've some experience with C# in the console and GDI The prob is with WPF which is the best apps...

WPF Databinding thread safety?

Well lets say i have an object that i databind to, it implements INotifyPropertyChanged to tell the GUI when a value has changed... if i trigger this from a different thread than the GUI thread how would wpf behave? and will it make sure that it gets the value of the property from memory and not the cpu cache? more or less im asking i...

In WPF RichTextBox, does overriding of Underline/Strikethrough work?

In a WPF RichTextBox, the effective style of a Run of text is a result of combining the properties defined on the Run with the properties it "inherits" from the enclosing Paragraph and finally the styles on the Document. So you can set FontWeight to Bold at any of those levels. You can also set it Bold on the Paragraph and then switch it...

How do I manually manage the generation of cell visuals with a GridViewColumn.CellTemplate?

I'm using WPF with .NET 3.0. I have a DataTemplate defined in XAML. I have a ListView with a GridView. I'd like to be able to generate the cell visuals with DataTemplate.LoadContent(), and insert the result into the GridView cell when needed. I need to do this so that I can set additional bindings on the generated visual object. Is ...

WPF/.NET data access models - resource recommendations

We're in the early design/prep phases of transferring/updating a rather large "legacy" 3 tier client-server app to a new version. We’re looking at doing WPF over Winforms as it appears to be the direction Microsoft is pushing development of the future and we’d like the maximize the life cycle/span of the apps. That said during the rewri...

media player questions

I'm making a media player in wpf using c#. I had 3 questions. I tried making a seeker XAML: <Slider Name="timelineSlider" Margin="40,91,26,0" ValueChanged="SeekToMediaPosition" Height="32" VerticalAlignment="Top" /> Code: private void Element_MediaOpened(object sender, EventArgs e) { timelineSlider.Maximum = ply.NaturalDuratio...

wpf c# databinding on object

Hello, say I have this control: public partial class bloc999 : UserControl { bloc999Data mainBlock = new bloc999Data(); public bloc999() { InitializeComponent(); mainBlock.txtContents = "100"; base.DataContext = mainBlock; } } in the xaml: <TextBox Margin="74,116,106,0" Name="txtContents" Text="{Binding Path=txtConte...

how do I measure the stroke angle?

I am working on wpf project, I want to know how to measure the angle of the stroke on the ink canvas? whether the stroke is right inclined or left inclined? ...