wpf

Error while setting a Datacontext for a UserControl in WPF

I have usercontrol where I am trying to set the context as below <UserControl.DataContext> <Binding ElementName="dataGrid" Path="MyViewModel"> </Binding> </UserControl.DataContext> Here dataGrid is a child DataGrid control and MyViewModel is my ViewModel class. Currently its giving following error while runtime: Cannot find ...

WPF: Sharing resources across assemblies

I previously posted a question on sharing resources across assemblies using Themes/generic.xaml and the ComponentResourceKey markup extension. The solution works nicely, but it requres all of the shared resources to be located in the generic.xaml resource dictionary. Mine is getting rather large, so I thought I would use merged dictionar...

Good framework for a C# developer to use for visually stunning presentation layer

I am about to write a front end app, which will be used as a media center app. It will plug directly into a high definition TV. Essentially transforming my laptop into a media player. While this concept is not new, I want custom functionality, so this is why I am not reusing existing products. I'm a C# developer, so the app should idea...

How to convert BitmapMetadata keys to corresponding XMP names?

I am writing an open-source library to extract image metadata and store as XMP serialized in an XML sidecar (ideally identically to how Adobe's apps serialize their metadata). My problem is it appears that BitmapMetadata has all of the values that I need, but the keys are mangled. Many of them are just integers, rather than their corres...

WPF Datagrid using MVVM.. is two way binding to DataTable possible?

I have a datagrid in my View with it's ItemSource bound to a DataTable in my ViewModel. When I update the DataTable programmatically (adding a column through a command) the changes are not populated to the View. Also, if I invalidate the View, by switching to another tab and then switching back, the changes made are shown. My ViewModel ...

Strange behaviour of code in WPF (rendering issue)

I a WPF application I have the following event-handler of a button-click in a code-behind file of a window: private void AddNewRecBtn_Click(object sender, RoutedEventArgs e) { DimRec.Visibility = System.Windows.Visibility.Visible; PrBarLayer.Visibility = System.Windows.Visibility.Visible; try ...

Set superscript and subscript in formatted text in wpf

How can i set some text as subscript/superscript in FormattedText in wpf ...

WPF Setting Image.Source from DataTrigger

Guys, I'm trying to define a DataTrigger for an Image element so that it shows a connected/disconnected image. I keep getting an Invalid PropertyDescriptor message. Any ideas? <Image> <Image.Style> <Style> <Style.Triggers> <DataTrigger Binding="{Binding Source={x:Static my:Server.Instance}, Path=Connected, M...

WPF seemingly super-simple dependency property

I'm puzzled. I'm trying to create a user control called TranslationView. It consists pretty much entirely of a single ListView. I don't think that's important now however, because I cannot even compile my code-behind. This is the code-behind for the user control: namespace Subster { /// <summary> /// Interaction logic for Tr...

Label and GroupBox triggers not working, same trigger works on StackPanel

I have a set of triggers in a XAML form, and for the life of me I can't figure out why one set works, and the other doesn't, despite being bound to the exact same variable. First, the triggers that do work: <StackPanel Orientation="Vertical" Margin="25,0,0,0"> <StackPanel.Style> <Style TargetType="{x:Type StackPanel}"> ...

WPF-based graph visualization

Does anybody know any sample of graph(vertices connected with edges) 3D visualization written on WPF or Silverlight? ...

Access control template property

Hey guys, I have the following control template: <ControlTemplate x:Key="GlassButton" TargetType="{x:Type Button}"> <ControlTemplate.Resources> <Storyboard x:Key="Timeline1"> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="glow" Storyboard.TargetProperty="(UIElement.Opacity)...

WPF: Composite Application with Page Navigation

I am currently writing an application to which the composite methodology fits like a glove.... almost! I also need a way to navigate between views, including maintaining a journal for navigation backward and forward. What is the best way to combine these two methodologies, on one hand the single Window based CAG shell with its UserCont...

Creating WPF BitmapImage from MemoryStream png, gif

Hi I am having some trouble creating a BitmapImage from a MemoryStream from png and gif bytes obtained from a web request. The bytes seem to be downloaded fine and the BitmapImage object is created without issue however the image is not actually rendering on my UI. The problem only occurs when the downloaded image is of type png or gif ...

WPF: Event Handlers in Codebehind's Constructor not hooking up.

Hi there! Sit Rep I have a WPF app. In the constructor of the (C#) code-behind I attach a button event-handler. Problem is, it doesn't attach! But if I attach it via clicking a UI button, then the button works fine. Also, of course, if I attach it in the button's XAML it works too. So, it appears that the prob is attaching the handler...

checkbox not setting dependency property

I have this DP: public bool ShowEntireHierarchyEx { get { return (bool)GetValue(ShowEntireHierarchyExProperty); } set { SetValue(ShowEntireHierarchyExProperty, value); } } public static readonly DependencyProperty ShowEntireHierarchyExProperty = DependencyProperty.Register("ShowEntireHierarchyEx"...

Bind WPF control to SQL server through repository pattern

How can I bind a wpf control to a SQL Server property. Like say a Listbox <ListView> <ListView.View> <GridView> <GridViewColumn Header="Name"> <GridViewColumn Header="Date Assigned"> <GridViewColumn Header="Date Due"> </GridView> </ListView.View> ...

WPF DataGrid Templates for sets of columns

I want to change the content of the data grid column definition based on state in the ViewModel or based on the data bound to the DataGrid. How do I do this via templates and template selectors? I want to write xaml and not code in order to do this. Ex: there are two subclasses A and B that have 5 common columns and 5 completely diffe...

Auto resize window content in WPF

When debugging my WPF programs I have noticed that when the window is the set size, the contols look just fine. But when the window is maximized, the content is positioned at the same place as if window has not resized. I want it so that the content and window resize proportionately. How can I do this? Sorry if it is a noobish question, ...

How to bind Popup's (or ContextMenu's) PlacementTarget to an element within UserControl?

In a scenario like this: <Grid> ... <local:MyControl x:Name="MyCtl" Grid.Row="1"/> <Popup PlacementTarget="{Binding ???}"/> <Grid> I need to bind PlacementTarget to a button named MyBtn within MyCtl. What is a cleanest way to do it? ...