Search Results

Search found 238 results on 10 pages for 'controltemplate'.

Page 6/10 | < Previous Page | 2 3 4 5 6 7 8 9 10  | Next Page >

  • Accessing WPF Template for Custom Control from Code behind

    - by Ashwani Mehlem
    Hi, i am trying to access a named grid inside a default template for a custom control from code behind. But it seems that the template for the control is null, even after calling ApplyTemplate(). Is that impossible inside the controls constuctor? Here's the code: Generic.xaml: ... <ControlTemplate TargetType="{x:Type local:TimeTableControl}"> <Grid Name="ContentGrid"> </Grid> </ControlTemplate> ... TimeTableControl.cs: public TimeTableControl() { ApplyTemplate(); contentGrid = (Grid)(Template.FindName("ContentGrid", this)); //Line above causes null-pointer-exception ... }

    Read the article

  • How do I make a simple image-based button with visual states in Silverlight 3?

    - by Jacob
    At my previous company, we created our RIAs using Flex with graphical assets created in Flash. In Flash, you could simply lay out your graphics for different states, i.e. rollover, disabled. Now, I'm working on a Silverlight 3 project. I've been given a bunch of images that need to serve as the graphics for buttons that have a rollover, pressed, and normal state. I cannot figure out how to simply create buttons with different images for different visual states in Visual Studio 2008 or Expression Blend 3. Here's where I am currently. My button is defined like this in the XAML: <Button Style="{StaticResource MyButton}"/> The MyButton style appears as follows: <Style x:Key="MyButton" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Image Source="/Assets/Graphics/mybtn_up.png" Width="54" Height="24"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="FocusStates"> <VisualState x:Name="Focused"/> <VisualState x:Name="Unfocused"/> </VisualStateGroup> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"/> <VisualState x:Name="MouseOver"/> <VisualState x:Name="Pressed"/> <VisualState x:Name="Disabled"/> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Image> </ControlTemplate> </Setter.Value> </Setter> </Style> I cannot figure out how to assign a different template to different states, nor how to change the image's source based on which state I'm in. How do I do this? Also, if you know of any good documentation that describes how styles work in Silverlight, that would be great. All of the search results I can come up with are frustratingly unhelpful. Edit: I found a way to change the image via storyboards like this: <Style x:Key="MyButton" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Image Source="/Assets/Graphics/mybtn_up.png" Width="54" Height="24" x:Name="Image"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="FocusStates"> <VisualState x:Name="Focused"/> <VisualState x:Name="Unfocused"/> </VisualStateGroup> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"/> <VisualState x:Name="MouseOver"> <Storyboard Storyboard.TargetName="Image" Storyboard.TargetProperty="Source"> <ObjectAnimationUsingKeyFrames> <DiscreteObjectKeyFrame KeyTime="0" Value="/Assets/Graphics/mybtn_over.png"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Pressed"> <Storyboard Storyboard.TargetName="Image" Storyboard.TargetProperty="Source"> <ObjectAnimationUsingKeyFrames> <DiscreteObjectKeyFrame KeyTime="0" Value="/Assets/Graphics/mybtn_active.png"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Disabled"/> </VisualStateGroup> </VisualStateManager.VisualStateGroups> </Image> </ControlTemplate> </Setter.Value> </Setter> </Style> However, this seems like a strange way of doing things to me. Is there a more standard way of accomplishing this?

    Read the article

  • wpf keep base style in custom control

    - by Archana R
    Hello, I have created a custom button as i wanted an image and a text inside it as follows: <Style TargetType="{x:Type Local:ImageButton}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Local:ImageButton}"> <StackPanel Height="Auto" Orientation="Horizontal"> <Image Margin="0,0,3,0" Source="{TemplateBinding ImageSource}"/> <TextBlock Text="{TemplateBinding Content}" /> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> Here, ImageButton is a class which inherits from Button class and has ImageSource as a dependency property. But i want to keep the look and feel of the original button. How can i do it? Thanks.

    Read the article

  • Update source with TemplateBinding

    - by Polaris
    I use this style for all my labels <Style TargetType="Label" x:Key="LabelStyle"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Label"> <StackPanel Orientation="Horizontal" > <TextBox Loaded="MyTextBlock_Loaded" x:Name="EditControl" Visibility="Collapsed" Text="{TemplateBinding Tag}" /> <Label Content="{TemplateBinding Content}" Grid.Column="1" Grid.Row="1"> </Label> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> and my sample label <Label Grid.Column="0" Grid.Row="0" Content="Photo" Style="{StaticResource LabelStyle}" Tag="{Binding fieldsCode.firstName, UpdateSourceTrigger=PropertyChanged}"/> But I feel that TemplateBiding doesn't support update of property. How can solve this issue

    Read the article

  • Wpf Listbox and CheckBox

    - by Tan
    Hi iam using a listbox to show a list of items. in the listbox i ahve an togglebutton on every item. When i click on the toggle button the state of the togglebutton is pressed. But when i am scrolling down in the listbox and scolls up again. The togglebutton state is not pressed. How can i prevent this please help. Heres my itemtemplate <ListBox.ItemTemplate> <DataTemplate> <StackPanel Margin="0,3,0,0"> <Border BorderBrush="Black" BorderThickness="1,1,1,1"> <Border.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox"> <GradientStop Color="#FFECECEC" Offset="1"/> <GradientStop Color="#FFE8E8E8"/> <GradientStop Color="#FFBDBDBD" Offset="0.153"/> <GradientStop Color="#FFE8E8E8" Offset="0.904"/> </LinearGradientBrush> </Border.Background> <Border.Style> <Style> <Style.Triggers> <DataTrigger Binding="{Binding Path=IsSelected, RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBoxItem}}}" Value="True"> <Setter Property="Border.Height" Value="100"/> <Setter Property="Border.Background"> <Setter.Value> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" MappingMode="RelativeToBoundingBox"> <GradientStop Color="DarkGray" Offset="1"/> <GradientStop Color="#FFE8E8E8"/> <GradientStop Color="#FFBDBDBD" Offset="0.153"/> <GradientStop Color="DarkGray" Offset="0.904"/> </LinearGradientBrush> </Setter.Value> </Setter> </DataTrigger> </Style.Triggers> </Style> </Border.Style> <StackPanel Orientation="Horizontal" VerticalAlignment="Center"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="500"/> <ColumnDefinition Width="100"/> <ColumnDefinition Width="55"/> </Grid.ColumnDefinitions> <!--Pick number--> <StackPanel Grid.Column="0" VerticalAlignment="Center" Orientation="Vertical"> <TextBlock Text="{Binding Path=FtgNamn}" FontWeight="Bold" FontSize="22pt" FontFamily="Calibri"/> <TextBlock Text="{Binding Path=LevsAttBeskr}" FontSize="18pt" FontFamily="Calibri"/> </StackPanel> <!--Pick Quantity--> <StackPanel Grid.Column="1" VerticalAlignment="Center"> <TextBlock Text="{Binding Path=Antal}" FontSize="44pt" FontFamily="Calibri"/> </StackPanel> <!-- Checkbox--> <StackPanel Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center"> <ToggleButton Name="Check" Width="40" Height="40" Click="Check_Click" Tag="{Binding Path=Plocklista}"> <ToggleButton.Style> <Style TargetType="ToggleButton"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ToggleButton}"> <Border x:Name="InnerBorder" Background="White" BorderBrush="Black" BorderThickness="1"/> <ControlTemplate.Triggers> <Trigger Property="IsChecked" Value="True"> <Setter TargetName="InnerBorder" Property="Background"> <Setter.Value> <ImageBrush ImageSource="/Images/button_ok.png"/> </Setter.Value> </Setter> <Setter TargetName="InnerBorder" Property="BorderThickness" Value="0"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </ToggleButton.Style> </ToggleButton> </StackPanel> </Grid> <Border BorderBrush="Darkgray" BorderThickness="0,0,1,0"> </Border> <TextBlock Width="100" Text="{Binding Path=Quantity}" FontSize="44pt" FontFamily="Calibri"/> <CheckBox Width="78"/> </StackPanel> </Border> </StackPanel> </DataTemplate>

    Read the article

  • ScrollViewer in a ListBox not working. WPF.

    - by guest
    Hi, I have the following defined in my control: <local:TestListBox.ItemTemplate> <DataTemplate> <Border x:Name="eventBorder" Width="{Binding ElementName=eventsLbx, Path=ActualWidth,BorderBrush="{Binding Color}" BorderThickness="1" CornerRadius="4"> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop x:Name="StartGradient" Color="#FFFFFFFF" Offset="0"/> <GradientStop x:Name="EndGradient" Color="{Binding Color}" Offset="1"/> </LinearGradientBrush> </Border.Background> <Border.ToolTip> <ToolTip Content="{Binding Text}"/> </Border.ToolTip> <TextBlock TextTrimming="CharacterEllipsis" HorizontalAlignment="Center" FontSize="12" Text="{Binding Text}" /> </Border> <DataTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="eventBorder" Property="Background" Value="#FFE4EBF5"/> </Trigger> </DataTemplate.Triggers> --> </DataTemplate> </local:TestListBox.ItemTemplate> </local:TestListBox> </ScrollViewer.Content> </ScrollViewer> </Grid> <ControlTemplate.Triggers> <Trigger SourceName="eventsLbx" Property="HasItems" Value="False"> <Setter TargetName="eventsLbx" Property="Visibility" Value="Hidden"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> Now if there are more items than are visible, then the scrollviewer appears properly but the user CANNOT drag the scrollviewer middle button for scrolling. The user can click on the arrows at the end of the scrollviewer to scroll but he cannot click the bar that appears on the scrollbar and drag it to actually scroll the contents. I cannot figure out why this is happening...

    Read the article

  • WPF: capturing XAML into subclassed control

    - by Sonic Soul
    hello, i narrowed down what i want my wpf button to look like using XAML. now i would like to create a sub classed button control that i can just re-use w/out having to write all that markup <Button Click="TestGridColumnButton_Click" Background="Transparent" Width="16" Height="16" Margin="0,0,0,0" Padding="0,0,0,0" BorderBrush="{x:Null}"> <Button.Template> <ControlTemplate> <Image HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource SourceStyle}" /> </ControlTemplate> </Button.Template> </Button> how can i set all these properties using C# ?

    Read the article

  • WPF Button on or off coloured state

    - by wonea
    I'm trying to create a set of button which have an off or on state, much a checkbox without the check. Ideally I want the colour to change to represent the two different states off(red), green(on). I've tried setting a control template but this only changes the colour for a selection, then reverts back to it's original colour once the mouse leaves the button's vicinity. <ControlTemplate.Triggers> <Trigger Property="IsPressed" Value="True"> <Setter Property="Background" TargetName="Background" Value="Green"/> </Trigger> </ControlTemplate.Triggers>

    Read the article

  • WPF: Can't get to original source from ExecutedRoutedEventArgs

    - by Ikhail
    I have a problem getting to the original source of a command using ExecutedRoutedEventArgs. I'm creating a simple splitbutton, in which a menu will appear below a dedicated button, as another button is pressed. When I click a menuitem in the appearing menu a command is fired. This command is registered on the splitbutton. And the idea is to get to the menuitem beeing clicked, by using the ExecutedRoutedEventsArgs. Ok, now the problem. If I choose to have the popup menu shown by default (IsOpen="True") and I click one of the menuitems I can get to the originalsource (thus the menuitem) from the ExecutedRoutedEventArgs - no problem. However, if I first click the button to show the menu and THEN click on a menuitem, the originalsource of the command will be the button instead of the MenuItem! Here's the controltemplate for the splitbutton: <ControlTemplate TargetType="{x:Type usc:SplitButton}"> <StackPanel Orientation="Horizontal"> <Button Name="mybutton"> <StackPanel> <Popup usc:SplitButton.IsPopup="True" IsOpen="True" Name="myPopup" PlacementTarget="{Binding ElementName=mybutton}" StaysOpen="False" Placement="Bottom"> <Border BorderBrush="Beige" BorderThickness="1"> <Menu Width="120"> <MenuItem Header="item1" Command="usc:SplitButton.MenuItemClickCommand" /> <MenuItem Header="item2" /> <MenuItem Header="item3" /> </Menu> </Border> </Popup> <TextBlock Text="MySplitbutton" /> </StackPanel> </Button> <Button Content="OK" Command="usc:SplitButton.ShowMenuCommand" /> </StackPanel> </ControlTemplate> The OK button fires a ShowMenuCommand on the SplitButton, which sets the IsOpen property on the Popup to True. Any ideas why the OK button (after having activated the menu) is the OriginalSource when a menuitem is clicked? Thanks.

    Read the article

  • Trouble displaying an object in WPF

    - by Scott
    I'm so new to this that I can't even phrase the question right... Anyway, I'm trying to do something very simple and have been unable to figure it out. I have the following class: public class Day : Control, INotifyPropertyChanged { public static readonly DependencyProperty DateProperty = DependencyProperty.Register("Date", typeof(int), typeof(Day)); public int Date { get { return (int)GetValue(DateProperty); } set { SetValue(DateProperty, value); if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("Date")); } } } public static readonly DependencyProperty DayNameProperty = DependencyProperty.Register("DayName", typeof(String), typeof(Day)); public String DayName { get { return (String)GetValue(DayNameProperty); } set { SetValue(DayNameProperty, value); if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("DayName")); } } } static Day() { DefaultStyleKeyProperty.OverrideMetadata(typeof(Day), new FrameworkPropertyMetadata(typeof(Day))); } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; #endregion } I've learned that you can't call a constructor that has parameters in XAML so the only way to actually set some data for this class is through the two properties, DayName and Date. I created a ControlTemplate for Day which is as follows: <Style TargetType="{x:Type con:Day}"> <Setter Property="MinHeight" Value="20"/> <Setter Property="MinWidth" Value="80"/> <Setter Property="Height" Value="20"/> <Setter Property="Width" Value="80"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type con:Day}"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Rectangle Grid.ColumnSpan="2" x:Name="rectHasEntry" Fill="WhiteSmoke"/> <TextBlock Grid.Column="0" x:Name="textBlockDayName" Text="{TemplateBinding DayName}" FontFamily="Junction" FontSize="11" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,2,0,0"/> <TextBlock Grid.Column="1" x:Name="textBlockDate" Text="{TemplateBinding Date}" FontFamily="Junction" FontSize="11" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,2,0,0"/> <Rectangle Grid.ColumnSpan="2" x:Name="rectMouseOver" Fill="#A2C0DA" Opacity="0" Style="{StaticResource DayRectangleMouseOverStyle}"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> I then render it on screen in my MainWindow thusly: <Window x:Class="WPFControlLibrary.TestHarness.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:con="clr-namespace:WPFControlLibrary.Calendar;assembly=WPFControlLibrary" Title="MainWindow" Height="500" Width="525" WindowStartupLocation="CenterScreen"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="80"/> </Grid.ColumnDefinitions> <con:Day Grid.Column="1" Height="20" Width="80" DayName="Mon" Date="1"/> </Grid> And what I actually see is, well, nothing. If I put my cursor on the con:Day line of the XAML it'll highlight the correctly sized rectangle in the window but I don't see "Mon" on the left side of the rectangle and "1" on the right. What am I doing wrong? I suspect it's something simple but I'll be darned if I'm seeing it. My ultimate goal is to group a bunch of the Day controls within a Month control, which is then contained in a Year control as I'm trying to make a long Calendar Bar that lets you navigate through the months and years, while clicking on a Day would display any information saved on that date. But I can't even get the Day part to display independent of anything else so I'm a long way from the rest of the functionality. Any help would be greatly appreciated.

    Read the article

  • Restyling RadDataPager for WPF and Silverlight

      A small but powerful control has joined the great family of Telerik XAML controls with the recent release. RadDataPager is a result of an increasing demand from our customers who needed to work with large amounts of server data presented in small portions at the client side.  The primary goal was to make a powerful data paging control to be used in any scenarios requiring getting and presenting portions of data. How good is RadDataPager in working with paged data you can see in Rossen's announcement. Yet being a XAML control it challenged us with making one more visually appealing and highly customizable control. It offers a slick look in all available WPF/Silverlight Telerik themes:     As you can see the default design is targeting mainly business scenarios. At the same time being an example for a truly lookless XAML control RadDataPager allows restyling with minimal efforts this way widening the possible range of applications.  Lets see what we can doo with a few lines of XAML : <Style x:Key="buttonStyle" TargetType="ButtonBase" > <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ButtonBase"> <Grid Width="40" Background="Black"> <Ellipse StrokeThickness="2" VerticalAlignment="Center" Width="15" Height="15" HorizontalAlignment="Center" Fill="Gray" /> <Ellipse Visibility="{Binding IsCurrent, Converter={StaticResource VisibilityConverter}}" VerticalAlignment="Center" Height="16" Fill="White" HorizontalAlignment="Center" Width="16"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> ... <telerik:RadDataPager NumericButtonStyle="{StaticResource buttonStyle}" ... And the result: The IPhone-style-thing bellow the RadCoverFlow is actually our RadDataPager.       With a few more lines of XAML we may get  almost any imaginable look of the pager control including the fascinating result demonstrated in the short video on the top.Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • WPF Button Storyboard with an image for MouseOver

    - by Vinjamuri
    I have the following xaml for changing the image for WPF button when mouse is on the button. It give below error. Any help is appreciated... 'System.Windows.Media.Animation.DoubleAnimation' animation object cannot be used to animate property 'Source' because it is of incompatible type 'System.Windows.Media.ImageSource'. <Style TargetType="{x:Type local:ButtonControl}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:ButtonControl}"> <Grid> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimation Storyboard.TargetName="img" Storyboard.TargetProperty="Source" To="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MouseOverImage}" /> </Storyboard> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Border> <Image x:Name="img" Source="pack://application:,,,/Recipe_06_13;component/Resources/normal.bmp" /> </Border> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style>

    Read the article

  • WPF Databound RadioButton ListBox

    - by Mark
    I am having problems getting a databound radiobutton listbox in WPF to respond to user input and reflect changes to the data it's bound to (i.e., to making changes in the code). The user input side works fine (i.e., I can select a radiobutton and the list behaves as expected). But every attempt to change the selection in code fails. Silently (i.e., no exception). Here's the relevant section of the XAML (I think): <Setter Property="ItemContainerStyle"> <Setter.Value> <Style TargetType="{x:Type ListBoxItem}" > <Setter Property="Margin" Value="2" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> <Border Name="theBorder" Background="Transparent"> <RadioButton Focusable="False" IsHitTestVisible="False" IsChecked="{Binding Path=IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" > <ContentPresenter /> </RadioButton> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </Setter.Value> I bind the listbox to a List of SchoolInfo objects. SchoolInfo contains a property called IsSelected: public bool IsSelected { get { return isSelected; } set { if( value != isSelected ) { isSelected = value; this.OnPropertyChanged("IsSelected"); } } } The OnPropertyChanged() stuff was something I put in during my experimentation. It doesn't solve the problem. Things like the following fail: ((SchoolInfo) lbxSchool.Items[1]).IsSelected = true; lbxSchool.SelectedIndex = 1; They fail silently -- no exception is thrown, but the UI doesn't show the item being selected. Mark

    Read the article

  • WPF combobox loses Aero theme when using a style trigger

    - by Greg R
    I am using style triggers to change combo box to texbox if it's readonly, but for some reason when I apply the style, it cause the combobox theme to change from Aero to Windows Classic (the theme I currently have in use on my PC). Can I avoid this somehow? Here is my code: <ComboBox ItemsSource="{Binding Source={StaticResource AllCountries}}" SelectedValue="{Binding OrderInfoVm.BillingCountry}" DisplayMemberPath="Value" SelectedValuePath="Key" IsReadOnly="{Binding ReadOnlyMode}" Style="{StaticResource EditableDropDown}" /> <Style x:Key="EditableDropDown" TargetType="ComboBox"> <Style.Triggers> <Trigger Property="IsReadOnly" Value="True"> <Setter Property="SelectedValuePath" Value="Content" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ComboBox"> <TextBox Text="{TemplateBinding SelectedValue, Converter={StaticResource StringCaseConverter}}" BorderThickness="0" Background="Transparent" FontSize="{TemplateBinding FontSize}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" FontFamily="{TemplateBinding FontFamily}" Width="{TemplateBinding Width}" TextWrapping="Wrap"/> </ControlTemplate> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style>

    Read the article

  • WPF: Convert string to system.windows.style

    - by xscape
    Is it possible to convert string to system.windows.style? How? Example: <Style TargetType="ToggleButton" x:Key="toggleCollapsed"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate TargetType="ToggleButton"> <Border Background="#00FFFFFF" Width="19" Height="13" > <Border BorderThickness="1,1,1,1" CornerRadius="1,1,1,1" BorderBrush="#FF8E997D" Width="9" Height="9" > <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="1,1"> <LinearGradientBrush.GradientStops> <GradientStop Color="#FFFFFFFF" Offset="0.4" /> <GradientStop Color="#FFC3BAAA" Offset="1" /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> <Path Data="M0,2L0,3 2,3 2,5 3,5 3,3 5,3 5,2 3,2 3,0 2,0 2,2z" x:Name="pathToggle" Fill="#FF000000" Margin="1,1,1,1"/> </Border> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> The style above is stored in my .resx. I want to convert it back to style

    Read the article

  • How do I get my custom WPF textbox to fill correctly?

    - by Dan Ryan
    I am trying to create a custom WPF textbox control that extends the standard textbox control but the extended textbox behaves differently when placed in control containers. Within my Window I have a stackpanel with a standard textbox and my extended textbox: <StackPanel Margin="10"> <TextBox Height="21" /> <l:SearchTextBox Search="SearchTextBox_Search" Height="21" Margin="0, 10, 0, 0" SearchMode="Delayed" HorizontalAlignment="Left" /> </StackPanel> The standard textbox stretches the length of the StackPanel whereas the custom textbox does not. How can I get the controls to behave the same? The styling for the custom textbox is shown below: <Style x:Key="{x:Type UIControls:SearchTextBox}" BasedOn="{StaticResource {x:Type TextBox}}" TargetType="{x:Type UIControls:SearchTextBox}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type UIControls:SearchTextBox}"> <TextBox /> </ControlTemplate> </Setter.Value> </Setter> </Style>

    Read the article

  • Iterating through StaticResource loaded by ResourceDictionary

    - by akaphenom
    Given a resource dictionary loading some static resources into memory - is there any way to iterate through theResources loaded into memory? My silverlight application keeps telling me it cannot find a static resource. I wonder if I have a naming convention issue or somehting - was hoping iterating through the resources in memory would help diagnose any issue... I have the following app.xaml <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Module1.MyApp"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/FSSilverlightApp;component/TransitioningFrame.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> and content template: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:Key="TransitioningFrame" TargetType="navigation:Frame"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <ContentPresenter Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}"/> </Border> </ControlTemplate> </ResourceDictionary>

    Read the article

  • Problem Binding a ObservableCollection to a ListBox in WPF/MVVM

    - by alexqs
    I'm working in some code , using wpf and starting to use mvvm. So far i have no problem, when i have one element and I have to show the values of it in the screen (binding of the specific name of the property). But now, i have to work with a property list , not knowing the names of it. So I created a class, named GClass, that only have two propierties, name and value. I created the ObservableCollection, and fill for now with direct values, and asign the view (lstview) datacontext with the object i have created. But I cant see any result, it always shows a blank listbox. Can someone tell me if see why is happening ? Code of c# VDt = new ObservableCollection<GClass>(); var vhDt = message.SelectSingleElement(typeof (Vh)) as Vehiculo; if(vhDt != null) { VDt.Add(new GClass() {Name = "Numero: ", Value = ""}); VDt.Add(new GClass() {Name = "Marca: ", Value = ""}); VDt.Add(new GClass() {Name = "Conductor: ", Value = ""}); lstview.DataContext = this; _regionManager.RegisterViewWithRegionInIndex(RegionNames.MainRegion, lstview, 0); Code of the view <ListBox Margin="5,5,5,25" ItemsSource="{Binding VDt}"> <ListBox.Template> <ControlTemplate> <ListViewItem Content="{Binding Name}"></ListViewItem> <ListViewItem Content="{Binding Value}"></ListViewItem> </ControlTemplate> </ListBox.Template> </ListBox> I have research here, but i cant see, what I'm doing wrong. I will apreciate if someone help me.

    Read the article

  • How to determine if a ResourceDictionary is loaded correctly

    - by akaphenom
    How can I tell (through the debugger if my app resources are being loaded correctly). I have tried (in f#) type MyApp() as this = inherit Application() do Application.LoadComponent(this, new System.Uri("/FSSilverlightApp;component/App.xaml", System.UriKind.Relative)) let cc = new ContentControl() let mainGrid : Grid = loadXaml("MainWindow.xaml") let siteTemplate : Grid = mainGrid let txt : TextBlock = siteTemplate ? txt do this.Startup.Add(this.startup) let mutable s = "Items: " s <- s + this.Resources.Count.ToString() it is returning a count of zero. Though I am pretty sure the application is loading the resource because if I change the path within the App.xaml - I get exceptions at runtime. Other re,lavent snippets are: I have the following app.xaml <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Module1.MyApp"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/FSSilverlightApp;component/TransitioningFrame.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application> and content template: < ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <ControlTemplate x:Key="TransitioningFrame" TargetType="navigation:Frame"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <ContentPresenter Cursor="{TemplateBinding Cursor}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}"/> </Border> </ControlTemplate> </ResourceDictionary>

    Read the article

  • Implicit theme error:The property 'Content' was not found in type 'System.Windows.Controls.Control'.

    - by Mark
    I have got an error while trying to upgrade our large project to SL4. I didn't write the original theme and my theme knowlege isn't great. In my demo app I have a Label and a LabelHeader(which i have created and is just a derived class from Label with DefaultStyleKey = typeof(LabelHeader); I am styling lthem like this: <Style TargetType="themeControls:LabelHeader"> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <DataInput:Label FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" Foreground="{TemplateBinding Foreground}" Content="{TemplateBinding Content}"/> </ControlTemplate> </Setter.Value> </Setter> <Setter Property="FontFamily" Value="Tahoma"/> <Setter Property="FontSize" Value="20"/> <Setter Property="Foreground" Value="Red"/> </Style> This works in SL3 but in SL4 I get: Error: Unhandled Error in Silverlight Application Code: 2500 Category: ParserError Message: The property 'Content' was not found in type 'System.Windows.Controls.Control'. File: Line: 9 Position: 168 If I change this: Content="{TemplateBinding Content}" to Content="XXX" Then there is no error but , of course, I get XXX in my label rather than the content I set in XAML on the page Any ideas how I can get this working? Demo project here: http://walkersretreat.co.nz/files/ThemeIssue.zip (Apologies for reposting, I have so far got no answers over here: http://forums.silverlight.net/forums/p/183380/415930.aspx#415930)

    Read the article

  • WPF ComboBox TemplateBinding to selected value

    - by Greg R
    I'm trying to create an editable textbox via a drop down of selected values. Basically in Red Only mode I want the drop down to be a disabled textbox. It works fine when I do this with SelectedValue but when I need it to display the dropdown text and not the value. This is what I have: <Style x:Key="EditableDropDownValueOnly" TargetType="ComboBox"> <Setter Property="Width" Value="Auto" /> <Setter Property="FontSize" Value="11" /> <Setter Property="HorizontalAlignment" Value="Left" /> <Setter Property="FontFamily" Value="Verdana" /> <Setter Property="MinWidth" Value="25" /> <Style.Triggers> <Trigger Property="IsReadOnly" Value="True"> <Setter Property="Background" Value="#FFFFFF" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ComboBox"> <TextBox Text="{TemplateBinding SelectedItem, Converter={StaticResource StringCaseConverter}}" BorderThickness="0" Background="Transparent" FontSize="{TemplateBinding FontSize}" HorizontalAlignment="{TemplateBinding HorizontalAlignment}" FontFamily="{TemplateBinding FontFamily}" Width="{TemplateBinding Width}" TextWrapping="Wrap"/> </ControlTemplate> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> SelectedItem is a KeyValuePair, since my drop down is bound to a dictionary. I'm trying to display the "Value" element in my template. Is that possible? Thanks a lot!

    Read the article

  • Style Trigger on Attached Property

    - by vanja.
    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.SetValue(SelectableProperty, value); } // Using a DependencyProperty as the backing store for Selectable. This enables animation, styling, binding, etc... public static readonly DependencyProperty SelectableProperty = DependencyProperty.RegisterAttached("Selectable", typeof(bool), typeof(Label), new UIPropertyMetadata(false)); } And then I'm trying to create a style with a trigger that depends on it: <!--Label--> <Style TargetType="{x:Type Label}"> <Style.Triggers> <Trigger Property="Util:LabelExtension.Selectable" Value="True"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Label}"> <TextBox IsReadOnly="True" Text="{TemplateBinding Content}" /> </ControlTemplate> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> But I'm getting a run time exception: Cannot convert the value in attribute 'Property' to object of type 'System.Windows.DependencyProperty'. Error at object 'System.Windows.Trigger' in markup file How can I access the value of the attached property in a style trigger? I have tried using a DataTrigger with a RelativeSource binding but it wasn't pulling the value through.

    Read the article

  • Silverlight for windows embedded

    - by Abhi
    Dear All This is my xaml file. <UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="SilverlightApplication1.Page" Width="640" Height="480" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"> <UserControl.Resources> <Style x:Key="ButtonStyle1" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Grid> <vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="FocusStates"> <vsm:VisualState x:Name="Unfocused"/> <vsm:VisualState x:Name="Focused"/> </vsm:VisualStateGroup> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.207"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.207"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="15.5"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="17.877"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Normal"/> <vsm:VisualState x:Name="Pressed"> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.567"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.567"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-32.5"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-37.483"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Disabled"/> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups> <Image Source="bounce_media.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" x:Name="image"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform/> <RotateTransform/> <TranslateTransform/> </TransformGroup> </Image.RenderTransform> </Image> <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="ButtonStyle2" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Grid> <vsm:VisualStateManager.VisualStateGroups> <vsm:VisualStateGroup x:Name="FocusStates"> <vsm:VisualState x:Name="Unfocused"/> <vsm:VisualState x:Name="Focused"/> </vsm:VisualStateGroup> <vsm:VisualStateGroup x:Name="CommonStates"> <vsm:VisualState x:Name="MouseOver"> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.243"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1.243"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="18.208"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="21"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Normal"/> <vsm:VisualState x:Name="Pressed"> <Storyboard> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.6"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.6"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-30"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)"> <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-34.6"/> </DoubleAnimationUsingKeyFrames> </Storyboard> </vsm:VisualState> <vsm:VisualState x:Name="Disabled"/> </vsm:VisualStateGroup> </vsm:VisualStateManager.VisualStateGroups> <Image Source="bounce_photo.png" Stretch="Fill" RenderTransformOrigin="0.5,0.5" x:Name="image"> <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform/> <RotateTransform/> <TranslateTransform/> </TransformGroup> </Image.RenderTransform> </Image> <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="pink"> <Button Height="173" HorizontalAlignment="Left" Margin="8,0,0,18" Style="{StaticResource ButtonStyle1}" VerticalAlignment="Bottom" Width="150" Content=""/> <Button Height="173" HorizontalAlignment="Right" Margin="0,0,35,18" Style="{StaticResource ButtonStyle2}" VerticalAlignment="Bottom" Width="150" Content=""/> </Grid> The above mentioned is an xaml file built using Microsoft Expression Blend 2 I have to use this xaml file as resource in my sub project using visual studio(c++). For this i have to develop a c++ code. But i am very unfamiliar with this technology and i need some guidance to obtain the task. Please also tell me where can i learn to develop a c++ code for this xaml file. I have heard that silverlight has its own API's which is entirely different from the WIN32 API's. I am familiar using WIN32 API's but unfamiliar with this Silverlight Technology. Please guide me the step or the tutorial site where i can learn the following concepts: 1. c++ coding in visual studio for SWE where xaml file is added as resource in my sub project. for ex:- How to write a c++ code for windows embedded for an xaml file which will display images which acts as a button in the emulator ?

    Read the article

  • How to assign Image Uri in a custom Control.

    - by Subhen
    Hi, I want to place an image inside my custom control , so my generic.xaml looks like below: <Style TargetType="local:generic"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:generic"> <Grid Background="{TemplateBinding Background}"> <Rectangle> <Rectangle.Fill> <SolidColorBrush x:Name="BackgroundBrush" Opacity="0" /> </Rectangle.Fill> </Rectangle> <TextBlock Text="{TemplateBinding Text}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}"/> <Image Source="{TemplateBinding Source}" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> My Codebehind is as follows: public class Generic : Control { public static DependencyProperty ImageUri = DependencyProperty.Register("Source", typeof(Uri), typeof(generic), new PropertyMetadata("")); public Uri Source { get { return (Uri)GetValue(generic.ImageUri); } set { SetValue(generic.ImageUri, value); } } public generic() { this.DefaultStyleKey = typeof(generic); } } Apllication is compiling fine but while I am trying to run it throws the following exception : $exception {System.Windows.Markup.XamlParseException: System.TypeInitializationException: The type initializer for 'testCstmCntrl.themes.generic' threw an exception. ---> System.ArgumentException: Default value type does not match type of property. Thanks, Subhen

    Read the article

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

    - by Simon_Weaver
    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" Value="False"/> <Setter Property="Margin" Value="2"/> <Setter Property="MinHeight" Value="5"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="dataFormToolkit:DataField"> <ContentControl x:Name="ContentControl" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="Stretch" IsTabStop="False" VerticalAlignment="Center"/> </ControlTemplate> </Setter.Value> </Setter> </Style> I've found a number of articles about styling DataForm but many of them seem to be out of date. I don't see anything in the complete extracted template in Blend that corresponds to spacing.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10  | Next Page >