xaml

How to set an event for all cells in WPF Datagrid

I need OnDragEnter event for every cell on my WPF Datagrid. I tried this : <ControlTemplate TargetType="{x:Type my:DataGridCell}" x:Key="RowTemplate"> <ContentPresenter DragEnter="ContentPresenter_DragEnter" > </ContentPresenter> </ControlTemplate> But doesn't seem to work. Any ideas people? Edit: Thanks for the responses...

Can I get a WPF ListBox to inherit brushes from parent element?

My WPF window has its foreground brush set to a brush from a resource dictionary, and I want all text in the window to have this color, so I don't touch the foreground brush in anything else. Textboxes get the color Textblocks get the color Buttons get the color Listboxes do not get the color, and so neither do their contents. Is ther...

Split WPF Style XAML Files

Most WPF styles I have seen are split up into one very long Theme.xaml file. I want to split mine up for readability so my Theme.xaml looks like this: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&gt; <ResourceDictionar...

Is it possible to seletively color a wrapping TextBlock in Silverlight/WPF

For instance, if I have a TextBlock: "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cill...

How to bind a property defined as usercontrol in XAML?

In XAML (Root is a UserControl), I have defined a grid with two columns. In a ViewModel layer, I have defined a property as UserControl. The ViewModel is set as DataContext of the XAML. How I can bind this property of type UserControl declarative to the grid? Thanks ...

WPF Key-Binding- Can I create a single key-binding that fires a command every time control is pressed with any number and then passes the number to the command as a parameter?

I need to create hot-keys for every control + number combination and would prefer not to have create ten commands. Is there any way to do this? ...

Creating a burn effect in Silverlight

Does anyone know of a tutorial on how to create a burn effect in Silverlight? ...

[XAML] datatrigger

Hi, I have a UserControl in XAML with a couple of buttons.... When the "VideoEnable" property in my C# code change to true i want to change the color of a button. The following code compiles but crashes and I cant find a right solution <UserControl.Triggers> <DataTrigger Binding="{Binding VideoEnable}" Value="true"> <Sett...

load directx xfile in xaml/wpf

How can I load a .x file in xaml/wpf? ...

In WPF XAML how can I concatenate 2 constants so I can use pre-define paths?

I'm new to XAML, so presume I'm missing something simple. I want to replace the path part of the source path with a c# constant for easier path management, for example I have: <Image Source="/Images/Themes/Buttons/MyPicture.png" /> and in another class I have my constant defined: public static readonly string UriImagesButtons = "/Ima...

auto focus camera on model

I have the following model <MeshGeometry3D x:Key="SphereOR10GR13" Positions="121.4130 33.9882 64.3701 85.0383 102.2932 168.1890 0.0000 0.0000 0.0000 68.8637 96.3488 159.4094 82.9020 105.2468 168.1890 36.2556 196.8622 64.3701 85.0383 138.7499 159.4094 148.6907 0.0000 23.3858 148.6907 260.7480 23.3858 89.4149 143.2779 1...

How to have a control fill all available space

I have a xaml code: <Grid> <WrapPanel> <TextBox ></TextBox> <Button Content="GetIt" /> </WrapPanel> </Grid> How i can to get all available space for textBox? i want to do something like that: |[__________][GetIt]| ...

WPF scrollviewer

Is there a posibility to scroll to a specific place in a ScrollViewer from your code behind? So something like the Slider element you can change the value property... ...

WPF binding only inside XAML (simple question)

Why this works <myToolTip:UserControl1> <TextBlock Text="{Binding Path=TestString, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type myToolTip:UserControl1}}}"/> </myToolTip:UserControl1> BUT this does not <myToolTip:UserControl1 x:Name="userControl"> <TextBlock Text="{Binding Path=TestString, ElementName=userCo...

How to convert a dynamic XAML into a PNG or GIF using C#?

I'm creating dynamic templated XAML designs that I would like to convert to PNG or GIF from my C# code. Any ideas? ...

In WPF how to define a Data template in case of enum?

I have a Enum defined as Type public Enum **Type** { OneType, TwoType, ThreeType }; Now I bind Type to a drop down Ribbon Control Drop Down Menu in a Ribbon Control that displays each menu with a MenuName with corresponding Image. ( I am using Syncfusion Ribbon Control ). I want that each enum type like ( OneType ) has dat...

XAML Deserialization problem

I have a block of XAML of which i'm trying to deserialize. For arguments sake lets say it looks like below. <NS:SomeObject> <NS:SomeObject.SomeProperty> <NS:SomeDifferentObject SomeOtherProp="a value"/> </NS:SomeObject.SomeProperty> </NS:SomeObject> Of which i deserialise using the following code. XamlReader.Load(File.OpenRe...

WPF DataGrid inside Accordion height issue

I am using the latest WPF Toolkit but am running into a height issue when I have a large record set bound into a datagrid inside an AccordionItem item. The height of the Accordion itself scales nicely but the datagrid inside the accordion control doesn't get get a scrollbar or get constrained in any way so the records are hidden. I know...

How to define descending sort order (in XAML) for DataGrid in SL/WPF?

In order to define column sorting the SortMemberPath can be used. But how can I define that this column shall be sorted descending? ...

WPF Error when implementing Login.xaml

I am getting the following exception: "Nullable object must have a value" Everything was working when I was using StartupURI="MainWindow.xaml" but I wanted to implement a login screen so I changed this to Startup="Application_Startup" and then created the following method in App.xaml.cs: private void Application_Startup...