xaml

How to loop through controls within TabItem

Hi, I'd like to loop through the controls within a TabItem. my xaml is something like TabControl TabItem ScrollViewer Grid I have tried TabItem ti = TabControl.Selected as TabItem foreach (UIElement control in ti) ... Which causes an error Basically I would like to get to the ScrollViewer Content or Grid Any ideas??...

How to customize the Visual Studio 2010 RC StartPage recent projects

I'd like to play around with customizing the visual studio 2010 rc start page recent items. For what I have in mind I'd need to customize the datasource / databinding but I can't find where the information is coming from. <ScrollViewer Grid.Row="1" HorizontalAlignment="Stretch" Style="{DynamicResource StartPage.ScrollViewerStyle}"...

Style Trigger on Attached Property

I have created my own Attached Property like this: public static class LabelExtension { public static bool GetSelectable(DependencyObject obj) { return (bool)obj.GetValue(SelectableProperty); } public static void SetSelectable(DependencyObject obj, bool value) { obj.Se...

Is there a way to do simple calculations in a xaml element binding statement other than using a converter?

In XAML I want to bind the height of one element to be half the height of another element. Is there a way to do this that doesn't involve writing a converter in the code-behind? Example:- What I've got... <Button Name="RemoveButton" Content="Remove Stage" Width="100" Height="{Binding ElementName=AddButton, Path=Height, Converter={Stat...

Access of Variables in Multiple Xaml files

How can we access variable from one Xaml file in to another xaml file in a same project ...

Howto bind a RoutedCommand in a child?

I am having trouble binding a Command that is generated up the UI tree to a control. The following example illustrates my point, the CommandBinding in Grid does not act on the InputBindings in Window. Maybe I do not understand the point of commands, but I would like to have a nice solution for child controls to act on user input on the W...

WPF Canvas Binding

Hey guys, I'm rather new to WPF, so maybe this is a simple question. I have a class that derives from Canvas, let's call it MyCanvas. And I have a class, MyClass, that has a property of type MyCanvas. In XAML, I built a TabControl, so each TabItem binds to a MyClass object. Now, in the Content of every tab I want to display MyObject.MyC...

WPF ListView in GridView mode Highlighting problem

While reskining GridView (ListView with more columns), I ran into a problem, that I couldn't change the color of the Highlighted row. I searched the internet and found out, that adding this can help. <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" /> <SolidColorBrush x:Key="{x:St...

Selecting a UserControl from XAML

I'm working on a problem right now where I need to embed a UserControl inside another UserControl. But, I need to determine at runtime which embedded UserControl to instantiate. This implies to me that some form of data binding and/or template selection mechanism has to be invoked, but I'm not sure how to proceed with the pure XAML appr...

How does the default xml namespace work in XAML?

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" How is this url mapped to .NET namespaces? Can you give an example how to do the same thing for custom .NET classes/namespaces? Is it an attribute that has to be defined on the namespace itself? Or is it a matter or using C# aliases as in?: using alias = FullNamespace ...

WPF tabcontrol styling

I've got a UI with a fairly standard look and feel. It has a column of icons on the left side which when clicked open a different user control on the right side. Currently I'm using separate controls for the selection icons and the usercontrol containment. I'm having strange focus issues that I am tired of trying to mitigate and am wonde...

How do I bind to another control's property from a trigger?

In my particular case, I want to bind to the IsReadOnly property of a TextBox to set the Content property of a Button? They are both part of the same StackPanel. I've tried doing it with a DataTrigger with a Binding to the ElementName of the TextBox and a Trigger using the TextBox name as the SourceName. Any thoughts? ...

XAML Serialization object not using asp.net shadow copy

Hi, I'm having a problem where i use the XAML serializer / deserializer for a configuration type file that i have. The problem that i'm getting, is that the XAML serializer is returning objects from the assembly in the /Bin directory, while the rest of the web application is using assembly's stored in the ..../Temporary Files/.. direc...

WPF - How to properly reference a class from XAML

OK, this is a super super noob question, one that I'm almost embarrassed to ask... I want to reference a class in my XAML file. It's a DataTemplateSelector for selecting the right edit template for a DataGrid column. Anyway, I've written the class into my code behind, added the local namespace to the top of top of the XAML, but when I ...

Import and render the contents of a XAML file inline in another XAML file?

I have a XAML file that I exported from Expression Design. I would like to render that XAML content inline in one of my user controls. Can I reference the external XAML file that I want to include as a Resource on the UserControl I want to render it in? Or is there some other markup that I can use to identify the XAML object in my pro...

Close WPF PopUp when clicking on Window Title bar.

I can see that the PopUp dropdown of a combobox gets closed if we click anywhere else in the app. How do I give that feature to my own Popup. I dont want to give a PreviewMouseDown event handler for the RootWindow to solve this issue. Something at the level of my userControl containing this popup. ...

How to get x:Name value runtime

I got: <ListView.View GridViewColumnHeader.Click="ColumnHeaderClick"> <GridView> <GridViewColumn x:Name="Col" Header="Item"> private void ColumnHeaderClick(object sender, RoutedEventArgs e) { GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader; } Now, how to get ...

Assigning an event or command to a DataTemplate in ResourceDictionary

I have the following class: public class Day { public int Date { get; set; } public String DayName { get; set; } public Day() { } public Day(int date, string dayName) { Date = date; DayName = dayName; CommandManager.RegisterClassCommandBinding(typeof(Day), new CommandBinding(DayCli...

reference from xaml to public class in .cs class file

I have in my WPF project file RssInfo.cs in which I have public class public class DoubleRangeRule : ValidationRule { public double Min { get; set; } public double Max { get; set; } public override System.Windows.Controls.ValidationResult Validate(object value, CultureInfo cult...

How do I change the spacing between fields in a DataForm?

How do I change the spacing between fields in a DataForm in Silverlight? I've tried editing the template but cannot find what I need. I thought all I needed to do was change the MinHeight and Margin of the DataField style, but that doesn't seem to do it. <Style TargetType="dataFormToolkit:DataField"> <Setter Property="IsTabStop...