xaml

WPF Optional Binding

I have an existing XAML file with some data templates in it. One of these datatemplate can be used in different situations. Therefore, I want to bind 1 of the properties only if a certain condition is true. What is the best way to achieve this? ...

How to change datatemplate through code

I have ListBox and DataTemplate I need Set GroupBox Heigth = 300 How to do it? <DataTemplate x:Key="data_template"> <GroupBox Header="Категория" Width="300" HorizontalAlignment="Stretch" x:Name="GroupBox"> <DockPanel Tag="{Binding id}"> <Button Click="Button_Click" DockPanel.Dock="Top" > <Button.Content> ...

Adding image from project space in C# xaml.cs

Hi guys, This is nothing short of embarrassing to ask but I'm having no luck with searches today. I have an image plane.png which I have added as an existing item to my project "Rem". I have map.xaml in this, but since I want to add multiple "plane.png" images to this, I am trying to create them in map.xaml.cs The XAML code to do what...

Rotating windows in WPF

I need to create a WPF application which is maximized and which rotates amongst about 10 different screens. Each screen will take the entire area and show different content. I already know how to maximize the window with My question is what is best to put inside that window to achieve what I want? Ideally I'd be able to have 10 dif...

WPF animation sometimes doesn't run

I have some pretty simple code that attempts to slide a custom progress bar over. Here is the XAML: <!-- Progress display --> <uControl:ProgressDisplayPie x:Name="soakProgressDisp" Canvas.Left="357" Canvas.Top="29" ProgressValue="0" Height="198" /> In response to a button click, the progress bar slides over: private void sau...

Loading Custom Styles in a WPF Custom Controls Library

I have a Custom Controls Library (ex. MyCustomControls.dll) that is a plugin to a 3rd party application. It outputs as a class library and is invoked by the 3rd party application at runtime. My issue is the custom styles I have defined for various user controls like listviewitem, textblock now cannot be loaded at the application level. ...

How to change the color of the a WPF `<Separator />`?

I use <Separator /> in my form but don't know how to change its color. None of Border /Foreground/Background does exist. Plese help. ...

[Silverlight] Defining Textbox-behaviour in XAML without Codebehind

Hello everyone, what I want to achieve is a pretty common thing, but I want to use the Silverlight advantage to keep the UI-Behaviour in XAML. I want a Textbox which has an 'empty' state like this: [ Name ] (Name in gray font), and when the Textbox receives Focus, the Fontcolor is supposed to change to black and the Textbox is suppose...

Simulating perspective by rotating an image filled rectangle using 2D transforms

Consider a WPF Rectangle filled with some ImageBrush. Now consider an arbitrary axis through rectangle center. I want to apply a 3D-like rotation around the axis employing only 2D transformations. Basically, I want to achieve perspective with "closer" edge of rectangle to appear larger than the "far" edge which should be visually smaller...

How to maintain aspect ratio of a rectangle as user resizes the browser

I'm using a rectangle with either with a fill from either a video or image brush. As the user resizes the browser the rectangle resizes, which is fine, except that it must keep it's 4:3 aspect ratio. How can I keep the aspect ratio constant? ...

How to compile IronRuby into a Silverlight Application (XAP) ??

I'm looking to possibly use IronRuby as the primary language for development of a Silverlight 4 application. I know there's the "IronRuby in the Browser" stuff that uses Gestalt, but I would like to build a standard Silverlight Applicatin using IronRuby and XAML that gets compiled into a XAP file, just like you can in C#. Anyone know if...

Is there a way to hide a specific column in a DataGrid when AutoGenerateColumns=True?

I have a WPF 4.0 DataGrid that is bound to a DataTable using AutoGenerateColumns=True. The columns are dynamic, however I know there is always going to be a column named ID and I would like to hide this column. Is there a way I can do this? ...

How can I add bold text and AccessText to a Label or TextBlock?

I have a WPF conundrum. I want some text to look like this: Enter this preparer's info: [ComboBox] Alt+E is the access key that focuses the ComboBox, and when Alt is pressed, the E in the text should be underlined. I can get the access key to work easily: <Label Target="{Binding ElementName=PreparerComboBox}"> _Enter this p...

Delete DataGrid row (WPF) by clicking Delete key button

Hi, I have WPF 4 desktop-based application. In one of the windows of this application I have DataGrid with data, binded with SQL Server database (via ADO.NET Entity Framework). In order to manipulate with data I have delete button, that deletes selected row from DataGrid and call SaveChanges() method. Now I want to add support for keyb...

Silverlight ListBox ItemTemplate: Make certain elements visible when item is selected

In a Windows Phone 7 Silverlight application, I have this ListBox: <ListBox ItemsSource="{Binding Path=Programs}" > <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Begin, Converter={Stati...

Silverlight Datagrid: Setting background of a template cell with custom behavior

I have a custom DataGrid mixed with DataGridTemplateColumns and a custom behavior derived from this answer http://stackoverflow.com/questions/3970363/silverlight-datagrid-highlight-an-entire-column-when-that-column-is-sorted. The problem I'm experiencing is that any DataGridTemplateColumn's cells are not picking up the 'highlight'. The c...

WPF RichTextBox: save/load in custom format

I need to load/save data from the WPF RichTextBox in a custom format (similar to Markdown). RichTextBox supports saving/loading in several basic formats (Rtf, Text, Xaml) using TextRange.Save method: using (FileStream fs = File.OpenWrite(file)) { TextRange text = new TextRange(rtNote.Document.ContentStart, rtNote.Document.Content...

Xaml Designer (# Develop) vs Aurora Xaml Designer (Mobiforms)

Could someone point out the better designer among Xaml Designer (by #Develop) and Aurora Xaml Designer (by Mobiforms). At which areas do you think #Develop is better and at which areas is Aurora Designer better? ...

change image source by xaml code?

How can I change an image source continuously by xaml codes?? ...

Binding Resources in XAML

I have a boolean flag in my DataContext which I would like a child control to use. Problem: I have a child control which uses it's own datasource. Hence, the datacontext of the entire page is not visibile to it. The child control needs to access this one property of the windows datacontext. I have managed to use a static boolean value...