xaml

How best to resize XAML with dynamic text

In a Silverlight interface I'm working on I have the need to resize a stack panel when its container resizes, to prevent the text in it from being truncated. The text in question is added at runtime from language files, depending on the language the user has selected. As the lengths of strings can vary considerably between languages I'm ...

How to disable some items in XAML for a WPF ListView

ok, sorry for the overly broad question, but lets see what you guys suggest.. I have a WPF ListView loaded by an XML file, using XAML (code below) I have a second xml file with items that match what is in my ListView. However, if there is not a match in the 2nd file, then i want that listitem disabled. a simple example: my ListView...

Data-Binding a WPF DataGrid Control to a System.Data.DataTable Object?

What do I need to do to get my WPF DataGrid control to bind to a DataTable object? I've been suffering over this for several days now. Even when the binding and the query both work correctly, and there is observable data in the table - nothing shows up in the data grid. My XAML code resembles this: <Window x:Class="DataGridTest....

dynamic ContexMenu

Hi! I have a problem. After Click MenuItem header: "System.XML.XMLElement". Can someone please tell me what I'm doing wrong? IpLisr.xml <?xml version="1.0" encoding="utf-8" ?> <IPList> <header Name="1" Click="1" Tag="1">192.168.0.100</header> <header Name="2" Click="2">192.168.0.101</header> <header Name="3" Click="3">192.168.0....

XBAP: Binding to object from resource not work?

In “Wpf Browser Application” project. Page: <Page.Resources> <local:SomeClass x:Key="someClass" Value="String from XAML"/> </Page.Resources> <StackPanel> <TextBox Text="{Binding Source={StaticResource someClass}, Path=Value}" /> </StackPanel> and class: internal class SomeClass { public SomeClass() { Value = "...

WPF application is crashing after publish

Hi, I've upgraded WPF application to Visual Studio 2k8. App is .NET 3.0 which is set as a platform in the project. If I build project & release confiuguration, app is running well. If I try to publish it using ClickOnce, it is crashing because xaml resources couldn't be find. Any idea? Thank you very much. P.S. It seem that XAML r...

How do you pass data into an IValueConverter in XAML?

I have an IValueConverter whose job it is to convert a BlockId to a ConditionLabel. The problem is that my Model object is what has the smarts to do the actual conversion. My code looks like this so far... public class BlockIdToConditionLabelConverter : IValueConverter { private Model _model; public BlockIdToConditionLabelConve...

What are the Silverlight 3 alternatives to DynamicResource and Element-based Brushes?

I need to have a custom UI element that can be changed, such as the colour and text used in the application but as a resource - in WPF I can use a DynamicResource to assign brushes, strings etc, however I need to implement this in Silverlight 3 - how can I do this as a StaticResource will not do, and as another question I have a resource...

How can I make a TextBox be a "password box" and display stars when using MVVM?

How can I do this in XAML: PSEUDO-CODE: <TextBox Text="{Binding Password}" Type="Password"/> so that the user sees stars or dots when he is typing in the password. I've tried various examples which suggest PasswordChar and PasswordBox but can't get these to work. e.g. I can do this as shown here: <PasswordBox Grid.Column="1" Grid....

Hidden features of WPF and XAML?

Here is a large number of hidden features discussed for variety of languages. Now I am curious about some hidden features of XAML and WPF? One I have found is the header click event of a ListView <ListView x:Name='lv' Height="150" GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"> The GridViewColumnHeader...

Any way to declare routing strategy for an WPF element?

Suppose we have a WPF element, for instance StackPanel with Buttons, Textboxes etc. inside. Is there any way to say directly in XAML that I want a tunneling strategy? <StackPanel RoutinStrategy="Tunneling" ... ...

Keyboard command to get out of auto generated double quotes

I have a real simple and seemingly stupid question, but I am getting alittle frusterated. I really like the intellesence in Visual Studio 2008, but there is one thing that is bothering me. When I am writing some XAML, and the intellesence comes up, I select the appropriate property and it automatically inserts it along with the nessesa...

How to change the look of an inactive window in XAML?

When I change the style of my window to WindowStyle="None" and AllowsTransparency="True" I lose the inactive window visuals. Is there a trigger I can use in the XAML style that can show a hidden mask or opacity changes in the main window when another window has focus? I'd like to be able to achieve this within the XAML and not programat...

Setting initial control focus in Silverlight

I'm looking for a way to automatically set the initial focus on a Silverlight UserControl to a specific control. I have a login page with a user name textbox and I'd like to have it so that as soon as the user goes to the page their cursor is already positioned and waiting in the username textbox instead of having to make them click the ...

Tab between List elements WPF

I have a listbox that in which every item is represented using a textbox. The thing is that I want to be able to tab between all the items in the listbox before moving to the next element in the xaml window. The current (and normal WPF behavior) is that when I tab into the listbox, the first element is highlighted, if I tab again, then ...

How to add multiple toolbox controls in xaml

Hi , I added <Image> // included an image in the window.</Image> If I wish to add a label just below the image and few other controls, how can i do it? The XAML Code is shown here. <Image Name="imgClientPhoto" HorizontalAlignment="Left" VerticalAlignment="Top" Width="auto" Height="auto" ...

How to make a custom WPF collection?

I'm trying to create a custom set of classes that can be added to a WPF control through XAML. The problem I'm having is adding items to the collection. Here's what I have so far. public class MyControl : Control { static MyControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(MyControl), new FrameworkPropertyMetad...

WPF MVVM - Can a single PropertyChanged update all the Data bindings of a DataTemplate?

I have a ViewModel class which has large number of properties(Say 50). Once the data is set on to all the properties I need to update the UI. I know that the common solution is to raise PropertyChanged on all the property setters. I am wondering if there is any way I can notify my DataTemplate to update all its bindings through a singl...

How do i control clipping in c# or xaml when using UniformToFill with an image.

I have an image control in a resizable window with its stretch property set to UniformToFill. <Image Name="some_image" Stretch="UniformToFill" Margin="0,0,0,0" /> The clipping window is pegged to the top left of the image; resizing chops off the right and bottom of the image. I want the image to be clipped equally on all sides. Am i...

how to show popup menu on click of checkbox column header in datagrid?

I am using the datagrid from WPF toolkit in a WPF windows application. It has a datatemplate in the rowheader which creates a checkbox column used for selecting the rows. If you click on the header row of the checkbox column (the top leftmost cell in the grid), it will check all the checkboxes in the grid thereby selecting all the rows....