Search Results

Search found 322 results on 13 pages for 'fontsize'.

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

  • ContentPresenter within ControlTemplate cannot change attached dependency property

    - by happyclicker
    Why does the following simplified code not set the font-size of the TextBlock to 50? <Window.Resources> <ControlTemplate TargetType="ContentControl" x:Key="Test"> <ContentPresenter TextBlock.FontSize="50" /> </ControlTemplate> </Window.Resources> <Grid> <ContentControl Template="{StaticResource Test}"> <TextBlock>Test should be rendered big</TextBlock> </ContentControl> </Grid> If I change the value of the FontSize property, visual studio shows me the text in the size I want. After compiling or executing the app, the size of the textblock is always reset to its default size. I have also tested various versions with styles and embedded resources but I end always in the situation that I cannot set attached dp's from within a ControlTemplate that contains a ContentPresenter. Is this by design?

    Read the article

  • Converting the content of <div> Tag To An Image [closed]

    - by ruhit
    how to convert the content of tag into image fomat in php, please someone help me,I realy need it....... i have made this application... <?php if(!isset($_GET['text'])) { die("No text provided"); } header ("Content-type: image/png"); $text = $_GET['text'] ; $path="C:\wamp\www\image"; $bg = imagecreatetruecolor(350, 75); //This will make it transparent imagesavealpha($bg, true); $trans_colour = imagecolorallocatealpha($bg, 0, 0, 0, 127); imagefill($bg, 0, 0, $trans_colour); $white = imagecolorallocate($bg, 255, 255, 255); $grey = imagecolorallocate($bg, 128, 128, 128); $black = imagecolorallocate($bg, 0,0,0); $background_color = imagecolorallocate ($bg, 25, 25, 25); $font = 'arial.ttf'; $fontsize = 20; imagettftext($bg, $fontsize, 0, 20, 20, $grey, $font, $text); //Create image imagepng($bg); imagepng($bg,"$path/img.png"); //destroy image ImageDestroy($bg); ?> and the image source is <img src="img.php?text=helloworld"> now I want the text input from a tag field, so how to do this?Please help me..

    Read the article

  • Populate two column grid with databinding?

    - by Richard
    How do i populate a two column grid with objects from my observable collection? I've tried to achieve this effect by using the tookits wrap panel but the items just stack. <toolkit:WrapPanel Margin="5,0,0,0" Width="400"> <ItemsControl ItemsSource="{Binding Trips}"> <ItemsControl.ItemTemplate> <DataTemplate> <StackPanel Height="236" Width="182"> <Button Style="{StaticResource VasttrafikButtonTrip}"> <StackPanel Width="152" Height="140"> <TextBlock Text="{Binding FromName}" /> <TextBlock FontFamily="Segoe WP Semibold" Text="till" /> <TextBlock Text="{Binding ToName}" /> </StackPanel> </Button> <TextBlock HorizontalAlignment="Left" Width="160" FontSize="16" FontWeight="ExtraBlack" Text="{Binding TravelTimeText}" /> <TextBlock HorizontalAlignment="Left" Width="160" Margin="0,-6,0,0" FontSize="16" Text="{Binding TransferCountText}" /> </StackPanel> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> </toolkit:WrapPanel>

    Read the article

  • Limiting the width of a TextBlock in Silverlight

    - by Druzil
    The obvious MaxWidth gets ignored and the text in the "DisplayBox" TextBlock displays the whole text even if this text continues past the parent container controls (to the edge of the silverlight area. <win:HierarchicalDataTemplate x:Key="hierarchicalTemplate" ItemsSource="{Binding _children}"> <Border BorderThickness="0" BorderBrush="Orange" HorizontalAlignment="Stretch" Background="{Binding Converter={StaticResource BackgroundConverter}}"> <toolkit:DockPanel LastChildFill="True" Width="{Binding HeirarchyLevel, Converter={StaticResource WidthConverter}}" Height="20"> <Canvas toolkit:DockPanel.Dock="Right" Width="20" MouseLeftButtonUp="Arrow_MouseLeftButtonDown"> <Rectangle Width="20" Height="20" Fill="Transparent" /> <Line Stroke="Black" X1="5" Y1="10" X2="17" Y2="10" /> <Line Stroke="Black" X1="11" Y1="5" X2="17" Y2="10" /> <Line Stroke="Black" X1="11" Y1="15" X2="17" Y2="10" /> </Canvas> <Ellipse Canvas.Top="5" Width="10" Height="10" Fill="Green" toolkit:DockPanel.Dock="Right" MouseLeftButtonDown="Ellipse_MouseLeftButtonDown" /> <Canvas Width="Auto" Loaded="TextArea_Loaded"> <TextBlock Name="DisplayBox" FontFamily="Arial" FontSize="17" Foreground="Black" Width="Auto" Text="{Binding TaskName}" MouseLeftButtonUp="TextBlock_MouseLeftButtonUp" /> <TextBox Name="EditBox" FontFamily="Arial" FontSize="10" Foreground="Black" Height="20" Text="{Binding TaskName}" Visibility="Collapsed" LostFocus="TextBox_LostFocus" /> <Line Stroke="Black" X1="0" Y1="10" X2="202" Y2="10" Width="Auto" /> </Canvas> </toolkit:DockPanel> </Border> </win:HierarchicalDataTemplate>

    Read the article

  • Cannont Update control in WPF custom control

    - by Fazi
    I have created a custom control which holds a button in it. The button is styled, so as to hold a grid with two rows, an image in the first and a TextBlock in the second. I have written an Event Handler for the custom control. When the mouse enters the path of the object the MouseEnter event fires, where I try to change the TextBlock's FontSize and Foreground color, however the control does not update. In contrast, I have tried to modify an regular TextBlock's(not part a custom control and controltemplate) properties, and they update correctly, on the fly. What am I missing here?? Here is the code for the event handler: private void ThemeButton_MouseEnter(object sender, MouseEventArgs e) { InitializeProperties(); TextElement.FontSize = 16; TextElement.Text = "new text"; TextElement.Foreground = Brushes.Red; TextBlock element = MainWindow.FindChild<TextBlock>(MainWindow.StartWindow, "textField"); element.Text = "new text for regular textblock"; element.Foreground = Brushes.Red; } InitializeProperties is a methid that initializes TextElement(typeof TextBlock) and ImageElement(typeof Image) properties. They are not null. The properties are just regular .NET properties.

    Read the article

  • What's the best way to handle layout issues with multi-language support in WPF/XAML?

    - by Tim
    I'm creating a standalone WPF app with multi-language support. I've found some great resources (mostly on SO) on how to store and access the strings as needed. This part is pretty straightforward and doable, but I'm fuzzy on how to take care of screen layout issues. I'm using some custom images to skin up my app for buttons, etc. For instance, here's a button with some text within: <Button Canvas.Left="33" Canvas.Top="484" Style="{StaticResource SmallButtonBase}"> <TextBlock FontSize="20" FontWeight="Bold" TextAlignment="Center" FontFamily="Helvetica"> Enter </TextBlock> </Button> Now here is the same button with text from another language: <Button Canvas.Left="33" Canvas.Top="484" Style="{StaticResource SmallButtonBase}"> <TextBlock FontSize="20" FontWeight="Bold" TextAlignment="Center" FontFamily="Helvetica"> Enterenschtein </TextBlock> </Button> So my question is: What is a good method to prevent this "overflow" situation. I'd like to have XAML take care of any font resizing or indenting that is needed automatically so that I don't have to tweak the UI for each language I'm supporting. Any insight is appreciated!

    Read the article

  • Need Help for Listview WPF events for finding index of rows and columns

    - by Ravi
    I have a listview in WPF and i displayed data in line by line manner,i want to just find the indexs of the rows and columns,i am new to WPF,plz give me some idea about this. <Grid Margin="3"> <Grid.RowDefinitions> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> <RowDefinition></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="600"></ColumnDefinition> <ColumnDefinition></ColumnDefinition> </Grid.ColumnDefinitions> <StackPanel Orientation="Horizontal" Grid.RowSpan="1"> <Label Name="lblID1" FontWeight="Bold" Grid.Row="0">ID:</Label> <Label Name="lblID" Grid.Row="0"> <TextBlock FontFamily="verdana" FontSize="12" FontWeight="Bold" Grid.Column="0" Padding="0" Text="{Binding Path=ID}"></TextBlock> </Label> <Label Name="lblDescrip1" FontWeight="Bold" Grid.Row="1">Description:</Label> <Label Name="lblDescrip"> <TextBlock FontFamily="verdana" FontSize="12" Grid.Column="1" Text="{Binding Path=DESCRIP}"></TextBlock> </Label> </StackPanel> Fee: Type: Special:

    Read the article

  • Updating the foreground of a label on window active property-WPF

    - by Deb
    I have a label which shows the name of the window. I want to update the colour of the label on the IsActive property of the window using styles and triggers so that all the labels inheriting this style should exhibit the same property. Please can anyone suggest me how? I tried like this: <Style TargetType="{x:Type Label}" x:Key="HeaderLabel"> <Style.Triggers> <DataTrigger Binding="{Binding (Window.IsActive)}" Value="True"> <Setter Property="FontSize" Value="15"/> <Setter Property="FontWeight" Value="Bold"/> <Setter Property="FontFamily" Value="Arial"/> <Setter Property="Foreground" Value="Black"/> <Setter Property="HorizontalAlignment" Value="Left"/> </DataTrigger> <DataTrigger Binding="{Binding (Window.IsActive)}" Value="False"> <Setter Property="FontSize" Value="15"/> <Setter Property="FontWeight" Value="Bold"/> <Setter Property="FontFamily" Value="Arial"/> <Setter Property="Foreground" Value="White"/> <Setter Property="HorizontalAlignment" Value="Left"/> </DataTrigger> </Style.Triggers> </Style>

    Read the article

  • Navigate to browser from selected listbox binded hyperlink (windows phone7)

    - by Ryan Smith
    I am bindind rss items from the net to this page, I cannot Seem to navigate to the link of a selected items hyper link which through binding is string. can anyone help me to navigate to weblink from a listbox item when selected ??? <ListBox Height="712" HorizontalAlignment="Left" Name="listNews" VerticalAlignment="Top" Width="468" SelectionChanged="listNews_SelectionChanged" Margin="0,-22,0,0"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal" Height="132"> <Image Source="{Binding Avatar}" Height="73" Width="73" VerticalAlignment="Top" Margin="0,7,5,0"/> <StackPanel Width="370"> <TextBlock Text="{Binding Newstitle}" TextWrapping="Wrap" Foreground="#FFC8AB14" FontSize="28" /> <HyperlinkButton Name="{Binding NewsLink}" Content="{Binding NewsLink}" NavigateUri="{Binding NewsLink}" FontSize="18" ClickMode="Press" Click="Selected" /> </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> private void listNews_SelectionChanged(object sender, SelectionChangedEventArgs e) { WebBrowserTask webBrowserTask = new WebBrowserTask(); webBrowserTask.URL = **???????;** webBrowserTask.Show();

    Read the article

  • video player recommendation (hardware)

    - by Fuxi
    hi all, i'm looking for a hardware-videoplayer with the following features: support for all kind of video formats from the web (xvid, divx, mpeg ..) w/o problems slots for memory cards like cf/sd usb connector for external devices like hd/usb sticks updateable firmware support for .srt files (subtitles) - option to change eg. fontsize currently i'm having a dvd player with memory slot but it only supports a few formats and it's very annoying having to convert anything - mostly it doesn't work. thx in advance

    Read the article

  • Optimizing a 3D World Javascript Animation

    - by johnny
    Hi! I've recently come up with the idea to create a tag cloud like animation shaped like the earth. I've extracted the coastline coordinates from ngdc.noaa.gov and wrote a little script that displayed it in my browser. Now as you can imagine, the whole coastline consists of about 48919 points, which my script would individually render (each coordinate being represented by one span). Obviously no browser is capable of rendering this fluently - but it would be nice if I could render as much as let's say 200 spans (twice as much as now) on my old p4 2.8 Ghz (as a representative benchmark). Are there any javascript optimizations I could use in order to speed up the display of those spans? One 'coordinate': <div id="world_pixels"> <span id="wp_0" style="position:fixed; top:0px; left:0px; z-index:1; font-size:20px; cursor:pointer;cursor:hand;" onmouseover="magnify_world_pixel('wp_0');" onmouseout="shrink_world_pixel('wp_0');" onClick="set_askcue_bar('', 'new york')">new york</span> </div> The script: $(document).ready(function(){ world_pixels = $("#world_pixels span"); world_pixels.spin(); setInterval("world_pixels.spin()",1500); }); z = new Array(); $.fn.spin = function () { for(i=0; i<this.length; i++) { /*actual screen coordinates: x/y/z --> left/font-size/top 300/13/0 300/6/300 | / |/ 0/13/300 ----|---- 600/13/300 /| / | 300/20/300 300/13/600 */ /*scale font size*/ var resize_x = 1; /*scale width*/ var resize_y = 2.5; /*scale height*/ var resize_z = 2.5; var from_left = 300; var from_top = 20; /*actual math coordinates: 1 -1 | / |/ 1 ----|---- -1 /| / | 1 -1 */ //var get_element = document.getElementById(); //var font_size = parseInt(this.style.fontSize); var font_size = parseInt($(this[i]).css("font-size")); var left = parseInt($(this[i]).css("left")); if (coast_line_array[i][1]) { } else { var top = parseInt($(this[i]).css("top")); z[i] = from_top + (top - (300 * resize_z)) / (300 * resize_z); //global beacause it's used in other functions later on var top_new = from_top + Math.round(Math.cos(coast_line_array[i][2]/90*Math.PI) * (300 * resize_z) + (300 * resize_z)); $(this[i]).css("top", top_new); coast_line_array[i][3] = 1; } var x = resize_x * (font_size - 13) / 7; var y = from_left + (left- (300 * resize_y)) / (300 * resize_y); if (y >= 0) { this[i].phi = Math.acos(x/(Math.sqrt(x^2 + y^2))); } else { this[i].phi = 2*Math.PI - Math.acos(x/(Math.sqrt(x^2 + y^2))); i } this[i].theta = Math.acos(z[i]/Math.sqrt(x^2 + y^2 + z[i]^2)); var font_size_new = resize_x * Math.round(Math.sin(coast_line_array[i][4]/90*Math.PI) * Math.cos(coast_line_array[i][0]/180*Math.PI) * 7 + 13); var left_new = from_left + Math.round(Math.sin(coast_line_array[i][5]/90*Math.PI) * Math.sin(coast_line_array[i][0]/180*Math.PI) * (300 * resize_y) + (300 * resize_y)); //coast_line_array[i][6] = coast_line_array[i][7]+1; if ((coast_line_array[i][0] + 1) > 180) { coast_line_array[i][0] = -180; } else { coast_line_array[i][0] = coast_line_array[i][0] + 0.25; } $(this[i]).css("font-size", font_size_new); $(this[i]).css("left", left_new); } } resize_x = 1; function magnify_world_pixel(element) { $("#"+element).animate({ fontSize: resize_x*30+"px" }, { duration: 1000 }); } function shrink_world_pixel(element) { $("#"+element).animate({ fontSize: resize_x*6+"px" }, { duration: 1000 }); } I'd appreciate any suggestions to optimize my script, maybe there is even a totally different approach on how to go about this. The whole .js file which stores the array for all the coordinates is available on my page, the file is about 2.9 mb, so you might consider pulling the .zip for local testing: metaroulette.com/files/31218.zip metaroulette.com/files/31218.js P.S. the php I use to create the spans: <?php //$arbitrary_characters = array('a','b','c','ddsfsdfsdf','e','f','g','h','isdfsdffd','j','k','l','mfdgcvbcvbs','n','o','p','q','r','s','t','uasdfsdf','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9',); $arbitrary_characters = array('cat','table','cool','deloitte','askcue','what','more','less','adjective','nice','clinton','mars','jupiter','testversion','beta','hilarious','lolcatz','funny','obama','president','nice','what','misplaced','category','people','religion','global','skyscraper','new york','dubai','helsinki','volcano','iceland','peter','telephone','internet', 'dialer', 'cord', 'movie', 'party', 'chris', 'guitar', 'bentley', 'ford', 'ferrari', 'etc', 'de facto'); for ($i=0; $i<96; $i++) { $arb_digits = rand (0,45); $arbitrary_character = $arbitrary_characters[$arb_digits]; //$arbitrary_character = "."; echo "<span id=\"wp_$i\" style=\"position:fixed; top:0px; left:0px; z-index:1; font-size:20px; cursor:pointer;cursor:hand;\" onmouseover=\"magnify_world_pixel('wp_$i');\" onmouseout=\"shrink_world_pixel('wp_$i');\" onClick=\"set_askcue_bar('', '$arbitrary_character')\">$arbitrary_character</span>\n"; } ?>

    Read the article

  • How to edit a StoryBoard to put it in a Button Style ?

    - by pi-corellis
    Hello, I've created a storyboard for a button in blend that I want it to apply everytime the button is pressed, So I tried to create a style,I've been stucked for a long time now. here is the code of my Storyboard: <Storyboard> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="button"> <EasingDoubleKeyFrame KeyTime="0" Value="1"> <EasingDoubleKeyFrame.EasingFunction> <CubicEase EasingMode="EaseOut"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0.85"> <EasingDoubleKeyFrame.EasingFunction> <QuinticEase EasingMode="EaseInOut"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"> <EasingDoubleKeyFrame.EasingFunction> <QuarticEase EasingMode="EaseIn"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="button"> <EasingDoubleKeyFrame KeyTime="0" Value="1"> <EasingDoubleKeyFrame.EasingFunction> <CubicEase EasingMode="EaseOut"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="0.85"> <EasingDoubleKeyFrame.EasingFunction> <QuinticEase EasingMode="EaseInOut"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="1"> <EasingDoubleKeyFrame.EasingFunction> <QuarticEase EasingMode="EaseIn"/> </EasingDoubleKeyFrame.EasingFunction> </EasingDoubleKeyFrame> </DoubleAnimationUsingKeyFrames> And Here is the code of my button style: <Style x:Key="ParametersButton" TargetType="ButtonBase" > <Setter Property="Background" Value="{StaticResource TransparentBrush}"/> <Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/> <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/> <Setter Property="MinHeight" Value="72" /> <Setter Property="BorderThickness" Value="{StaticResource PhoneDefaultBorderThickness}"/> <Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilyNormal}"/> <Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMediumLarge}"/> <Setter Property="Padding" Value="0,15,15,0"/> <Setter Property="Height" Value="72"/> <Setter Property="Width" Value="72"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="ButtonBase"> <Grid Background="Transparent" > <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"/> <VisualState x:Name="MouseOver"/> <VisualState x:Name="UnPressed"/> <VisualState x:Name="Pressed"> <Storyboard> <!--Here is where I want to insert my StoryBoard--> </Storyboard> </VisualState> <VisualState x:Name="Disabled"/> </VisualStateGroup> <VisualStateGroup x:Name="FocusStates"> <VisualState x:Name="Focused"/> <VisualState x:Name="Unfocused"/> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Border x:Name="ButtonBackground" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="0" CornerRadius="0" Background="#FF1BA1E2" Margin="{StaticResource PhoneTouchTargetOverhang}" RenderTransformOrigin="0.5,0.5"> <ContentControl x:Name="foregroundContainer" FontFamily="{TemplateBinding FontFamily}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" FontSize="{TemplateBinding FontSize}" Padding="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/> </Border> </Grid> </ControlTemplate> </Setter.Value> </Setter> How can I proceed ? Thanks, Renaud

    Read the article

  • WPF: Setting DataContext of a UserControl with Binding not working in XAML

    - by Grant Crofton
    Hi, I'm trying to get my first WPF app working using MVVM, and I've hit a little binding problem. The setup is that I have a view & viewModel which holds User details (the parent), and to try and keep things simple I've put a section of that view into a separate view & viewModel (the child). The child view is defined as a UserControl. The issue I'm having is how to set the DataContext of the child view (the UserControl). My parent ViewModel has a property which exposes the child ViewModel, like so: class ParentViewModel: INotifyPropertyChanged { public ChildViewModel childViewModel { get; set; } //... } In the XAML for my parent view (which has it's DataContext set to the ParentViewModel), I try to set the DataContext of the child view as follows: <views:ChildView x:Name="ChildView" DataContext="{Binding childViewModel}"/> However, this doesn't work. The DataContext of the child view is set to the same DataContext as the parent view (i.e. the ParentViewModel), as if I wasn't setting it at all. I also tried setting the DataContext in the child view itself, which also doesn't work: <UserControl x:Class="DietRecorder.Client.View.ChildView" DataContext="childViewModel" I have found a couple of ways around this. In the child view, I can bind everything by including the ChildViewModel in the path: <SomeControl Visibility="{Binding Path=childViewModel.IsVisible}"> but I don't want the child view to have this level of awareness of the hierarchy. Setting the DataContext in code also works - however, I have to do this after showing the parent view, otherwise the DataContext just gets overwritten when I call Show(): parentView.Show(); parentView.ChildView.DataContext = parentViewModel.childViewModel; This code also makes me feel uneasy, what with the LOD violation and all. It's just the DataContext that seems to be the problem - I can bind other things in the child, for example I tried binding the FontSize to an int property just to test it: <views:ChildView x:Name="ChildView" FontSize="{Binding Path=someVal}"/> And that works fine. But I'm sure binding the DataContext should work - I've seen similar examples of this kind of thing. Have I missed something obvious here? Is there a reason this won't work? Is there a spelling mistake somewhere? (I renamed things for your benefit so you won't be able to help me there anyway). Any thoughts welcome. Thanks, Grant

    Read the article

  • Add animation when user control get visible and collapsed In Wpf

    - by sanjeev40084
    I have two xaml files MainWindow.xaml and other user control WorkDetail.xaml file. MainWindow.xaml file has a textbox, button, listbox and reference to WorkDetail.xaml(user control which is collapsed). Whenever user enter any text, it gets added in listbox when the add button is clicked. When any items from the listbox is double clicked, the visibility of WorkDetail.xaml is set to Visible and it gets displayed. In WorkDetail.xaml (user control) it has textblock and button. The Textblock displays the text of selected item and close button sets the visibility of WorkDetail window to collapsed. Now i am trying to animate WorkDetail.xaml when it gets visible and collapse. When any items from listbox is double clicked and WorkDetail.xaml visibility is set to visible, i want to create an animation of moving WorkDetail.xaml window from right to left on MainWindow. When Close button from WorkDetail.xaml file is clicked and WorkDetail.xaml file is collapsed, i want to slide the WorkDetail.xaml file from left to right from MainWindow. Here is the screenshot: MainWindow.xaml code: <Window...> <Grid Background="Black" > <TextBox x:Name="enteredWork" Height="39" Margin="44,48,49,0" TextWrapping="Wrap" VerticalAlignment="Top"/> <ListBox x:Name="workListBox" Margin="26,155,38,45" FontSize="29.333" MouseDoubleClick="workListBox_MouseDoubleClick"/> <Button x:Name="addWork" Content="Add" Height="34" Margin="71,103,120,0" VerticalAlignment="Top" Click="Button_Click"/> <TestWpf:WorkDetail x:Name="WorkDetail" Visibility="Collapsed"/> </Grid> </Window> MainWindow.xaml.cs class code: namespace TestWpf { public partial class MainWindow : Window { public MainWindow() { this.InitializeComponent(); } private void Button_Click(object sender, RoutedEventArgs e) { workListBox.Items.Add(enteredWork.Text); } private void workListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e) { WorkDetail.workTextBlk.Text = (string)workListBox.SelectedItem; WorkDetail.Visibility = Visibility.Visible; } } } WorkDetail.xaml code: <UserControl ..> <Grid Background="#FFD2CFCF"> <TextBlock x:Name="workTextBlk" Height="154" Margin="33,50,49,0" TextWrapping="Wrap" VerticalAlignment="Top" FontSize="29.333" Background="#FFF13939"/> <Button x:Name="btnClose" Content="Close" Height="62" Margin="70,0,94,87" VerticalAlignment="Bottom" Click="btnClose_Click"/> </Grid> </UserControl> WorkDetail.xaml.cs class code: namespace TestWpf { public partial class WorkDetail : UserControl { public WorkDetail() { this.InitializeComponent(); } private void btnClose_Click(object sender, System.Windows.RoutedEventArgs e) { Visibility = Visibility.Collapsed; } } } Can anyone tell how can i do this?

    Read the article

  • WPF TextBox SpellChecking Problem

    - by Alex
    How can I change the spellchecking language of a WPF textbox to french using XAML? I tried this but it doesn't work. <TextBox AcceptsReturn="true" SpellCheck.IsEnabled="true" FontSize="12" BorderBrush="Blue" Height="100" Language="fr-fr" /> French is supposed to be one of the 4 supported languages for spellchecking in WPF so I don't understand why it doesn't work. I also tried fr-CA but it still won't work.

    Read the article

  • Default custom ControlTemplate is not applied when using Style

    - by gehho
    Hi all, I have created a default style for a Button including a custom ControlTemplate like so: <Style TargetType="{x:Type Button}"> <Setter Property="OverridesDefaultStyle" Value="True"/> <Setter Property="Background" Value="White"/> <Setter Property="BorderBrush" Value="Black"/> <!-- ...other property setters... --> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Button}"> <Grid x:Name="gridMain"> <!-- some content here --> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> This style is added to my shared ResourceDictionary which is loaded by every control. Now, this style/template is applied to all my buttons, as expected, but it is NOT applied to those buttons which locally use a different style. For example, I want to have a certain margin for my "OK", "Apply" and "Cancel" buttons. Therefore, I defined the following style: <Style x:Key="OKApplyCancelStyle" TargetType="{x:Type Button}"> <Setter Property="Margin" Value="4,8"/> <Setter Property="Padding" Value="8,6"/> <Setter Property="MinWidth" Value="100"/> <Setter Property="FontSize" Value="16"/> </Style> ...and applied that style to my buttons using a StaticResource: <Button Content="OK" Style="{StaticResource OKApplyCancelStyle}"/> For me, the expected result would be that the ControlTemplate above would still be applied, using the values for Margin, Padding, MinWidth and FontSize from the "OKApplyCancelStyle". But this is not the case. The default Windows ControlTemplate is used instead, using the values from the style. Is this the typical behavior? Does a local style really override a custom ControlTemplate? If so, how can I achieve my desired behavior? I.e. still use my custom ControlTemplate even when styles are defined locally? Many thanks in advance, gehho.

    Read the article

  • WPF ListView Data Binding wont synchronize

    - by Aviatrix
    my listview will display only the item that its added by the constructor and it wont add the items that i add dynamically public class PostList : ObservableCollection<PostData> { public PostList() : base() { Add(new PostData("Isak", "Dinesen")); // Add(new PostData("Victor", "Hugo")); // Add(new PostData("Jules", "Verne")); } public void AddToList (string[] data){ string username2, msg; msg = data[0]; username2 = data[1]; Add(new PostData(msg, username2)); } } public class PostData { private string Username; private string Msg; private string Avatar; private string LinkAttached; private string PicAttached; private string VideoAttached; public PostData(string msg ,string username, string avatar=null, string link=null,string pic=null ,string video=null) { this.Username = username; this.Msg = msg; this.Avatar = avatar; this.LinkAttached = link; this.PicAttached = pic; this.VideoAttached = video; } public string pMsg { get { return Msg; } set { Msg = value; } } public string pUsername { get { return Username; } set { Username = value; } } ..... ..... } Xaml <ListView x:Name="PostListView" BorderThickness="0" MinHeight="300" Background="{x:Null}" BorderBrush="{x:Null}" Foreground="{x:Null}" VerticalContentAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled" IsSynchronizedWithCurrentItem="True" MinWidth="332" SelectedIndex="0" SelectionMode="Extended" AlternationCount="1" ItemsSource="{Binding Source={StaticResource PostListData}}"> <ListView.ItemTemplate> <DataTemplate> <DockPanel x:Name="SinglePost" VerticalAlignment="Top" ScrollViewer.CanContentScroll="True" ClipToBounds="True" Width="333" Height="70" d:LayoutOverrides="VerticalAlignment" d:IsEffectDisabled="True"> <StackPanel x:Name="AvatarNickHolder" Width="60"> <Label x:Name="Nick" HorizontalAlignment="Center" Margin="5,0" VerticalAlignment="Top" Height="15" Content="{Binding Path=pUsername}" FontFamily="Arial" FontSize="10.667" Padding="5,0"/> <Image x:Name="Avatar" HorizontalAlignment="Center" Margin="5,0,5,5" VerticalAlignment="Top" Width="50" Height="50" IsHitTestVisible="False" Source="1045443356IMG_0972.jpg" Stretch="UniformToFill"/> </StackPanel> <TextBlock x:Name="userPostText" Margin="0,0,5,0" VerticalAlignment="Center" FontSize="10.667" Text="{Binding Path=pMsg}" TextWrapping="Wrap"/> </DockPanel> </DataTemplate> </ListView.ItemTemplate> </ListView>

    Read the article

  • Keeping WPF grids from getting out of parent bounds

    - by Jonathan Perry
    In my UI, I have a big grid with two columns and one row. in the right column, I have a grid with three rows where in the top row I have a user control, and in the two bottom rows I have two Expander objects, each containing an ItemsControl with a list that gets populated in runtime. Sometimes, that list gets really long and "spills" from the screen towards the bottom. What I want to do is to allow the user to see both expanders, be able to expand or collapse them while keeping them both in sight. I tried wrapping them in WrapPanels or StackPanel but to no avail. Here's some code to help explain my problem: <Grid Grid.Row="1" x:Name="grid1"> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <Expander Grid.Row="0" Header="Expander 1" x:Name="expander1" FontSize="14" IsExpanded="True"> <Expander.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFC4C4C4" Offset="0" /> <GradientStop Color="White" Offset="1" /> </LinearGradientBrush> </Expander.Background> <ContentPresenter Content="{Binding ViewModel.OpenAlerts, ElementName=m_viewControl}" ClipToBounds="True"/> </Expander> <Expander Grid.Row="1" x:Name="expander2" Header="Expander 2" FontSize="14" IsExpanded="True"> <Expander.Background> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="#FFC4C4C4" Offset="0" /> <GradientStop Color="White" Offset="1" /> </LinearGradientBrush> </Expander.Background> <ContentPresenter Content="{Binding ViewModel.ClosedAlerts, ElementName=m_viewControl}" ClipToBounds="True"/> </Expander> </Grid> Any assistance or tips will be highly appreciated! Thanks, John.

    Read the article

  • Get rid of button border in WPF?

    - by sanjeev40084
    i am trying to get rid of button border and only display text, however a thin line around the text gets displayed even though i set borderThickness to 0 and borderbrush to transparent. my xaml code for save button: <Button Content="save" Name="btnSaveEditedText" Background="Transparent" Foreground="White" FontFamily="Tw Cen MT Condensed" FontSize="30" Margin="-280,0,0,10" Width="60" BorderBrush="Transparent" BorderThickness="0"/> Is there anyway i can get rid of the button border?

    Read the article

  • My style/control template out my calendar's blackout dates.

    - by Chris
    Howdy, My C#/WPF project needs a calendar. We're going to be using it to pick a range of dates for appointment scheduling. I'm told the default calendar is too small to be used by some of our reps so I've been working on resizing it. <toolkit:Calendar Grid.Row="1" x:Name="DateWindowCalendar" BorderBrush="White" BorderThickness="0" Style="{StaticResource PopupCalendarStyle}" DisplayMode="Month" SelectionMode="SingleRange" DisplayDateStart="{Binding FirstDayOfMonth}" AutomationProperties.AutomationId="ToolkitCalendarId" VerticalAlignment="Top"> </toolkit:Calendar> And I've created this styling: <Style x:Key="PopupCalendarStyle" TargetType="toolkit:Calendar"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="toolkit:Calendar"> <StackPanel Margin="0" HorizontalAlignment="Center" x:Name="Root"> <toolkit:Calendar x:Name="Calendar" SelectedDate="{TemplateBinding SelectedDate}" DisplayDateStart="{TemplateBinding DisplayDateStart}" SelectionMode="{TemplateBinding SelectionMode}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SelectedDatesChanged="Calendar_SelectedDatesChanged"> <toolkit:Calendar.CalendarDayButtonStyle> <Style> <Setter Property="Button.Height" Value="34"/> <Setter Property="Button.Width" Value="34" /> <Setter Property="Button.FontSize" Value="16" /> </Style> </toolkit:Calendar.CalendarDayButtonStyle> <toolkit:Calendar.CalendarButtonStyle> <Style> <Setter Property="Button.Height" Value="34"/> <Setter Property="Button.Width" Value="34"/> <Setter Property="Button.FontSize" Value="16"/> </Style> </toolkit:Calendar.CalendarButtonStyle> </toolkit:Calendar> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> Everything is almost perfect. I specify my range, I can track the selected dates (granted using the SelectedDatesChanged event instead of the SelectedDates property. The problem is I also need to be able to set blackout dates (usually the period between first of the month and today although sometimes first of the month to a few days from now). Without the styling, this works: DateWindowCalendar.BlackoutDates.Add(new CalendarDateRange( new DateTime(DateTime.Now.Year, DateTime.Now.Month, 01), DateTime.Now)); But when I add the style, I don't get the black out displays being displayed and worse its possible to select the blackout dates. I'm not sure what I missed but I'm hoping someone has an easy answer so that I don't have to rebuild the entire widget. Any help is appreciated. Thanks, Chris

    Read the article

  • Native ComboBox not displaying choices correctly

    - by anothershrubery
    EDIT: It seems that ListPicker is the way to go but I have had further problems with that detailed Microsoft.Phone.Controls.Toolkit ListPicker throws XamlParseException I have the following ComboBox in code: <ComboBox x:Name="Result" Grid.Column="6" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" Background="White"> <ComboBoxItem Content="Win" /> <ComboBoxItem Content="Place" /> <ComboBoxItem Content="Lose" /> </ComboBox> But it does not display as I would have expected. When you drop down the ComboBox the options don't appear, it's just like empty items. See below: However, when an item is selected, it displays correctly and the correct index/item is returned. See below: I'm sure there is something simple I have missed but can't put my finger on it. EDIT: Ok I am posting the full code for this. I have a user control, OddsRow, that looks like this: <UserControl xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" x:Class="MojoPinBetOddsCalculator.OddsRow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" d:DesignHeight="480" d:DesignWidth="480"> <Grid x:Name="LayoutRoot" Background="{StaticResource PhoneChromeBrush}"> <Grid.RowDefinitions> <RowDefinition Height="70"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="50*"></ColumnDefinition> <ColumnDefinition Width="70*"></ColumnDefinition> <ColumnDefinition Width="30*"></ColumnDefinition> <ColumnDefinition Width="70*"></ColumnDefinition> <ColumnDefinition Width="70*"></ColumnDefinition> <ColumnDefinition Width="70*" ></ColumnDefinition> <ColumnDefinition Width="100*"></ColumnDefinition> </Grid.ColumnDefinitions> <TextBlock x:Name="RowNumber" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock> <TextBox x:Name="OddsNumerator" Grid.Column="1" Width="90" Height="70" HorizontalAlignment="Center" TextAlignment="Center" VerticalAlignment="Center" MaxLength="3" InputScope="TelephoneNumber"></TextBox> <TextBlock x:Name="Slash" Grid.Column="2" Text="/" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> <TextBox x:Name="OddsDenominator" Grid.Column="3" Width="90" Height="70" VerticalAlignment="Center" TextAlignment="Center" MaxLength="3" HorizontalAlignment="Center" InputScope="TelephoneNumber"></TextBox> <CheckBox x:Name="EachWay" Grid.Column="4" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10,0,0,0" /> <CheckBox x:Name="Place" Grid.Column="5" HorizontalAlignment="Center" VerticalAlignment="Center" BorderThickness="0" Width="71" Margin="10,0,0,0" Padding="0" /> <ComboBox x:Name="Result" Grid.Column="6" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Black" Background="White"> <ComboBoxItem Content="Win" /> <ComboBoxItem Content="Place" /> <ComboBoxItem Content="Lose" /> </ComboBox> </Grid> </UserControl> And it is displayed in the MainPage like so: <phone:PhoneApplicationPage xmlns:my="clr-namespace:MojoPinBetOddsCalculator" x:Class="MojoPinBetOddsCalculator.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" shell:SystemTray.IsVisible="True"> <!--LayoutRoot is the root grid where all page content is placed--> <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <!--TitlePanel contains the name of the application and page title--> <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> <TextBlock x:Name="ApplicationTitle" Text="BET ODDS CALCULATOR" Style="{StaticResource PhoneTextNormalStyle}"/> <TextBlock x:Name="PageTitle" Text="calculate" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> </StackPanel> <!--ContentPanel - place additional content here--> <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" HorizontalAlignment="Stretch"> <Grid x:Name="Scrollable"> <ScrollViewer> <Grid x:Name="BettingGrid"> <Grid.RowDefinitions> <RowDefinition Height="Auto"></RowDefinition> <RowDefinition Height="*"></RowDefinition> </Grid.RowDefinitions> <Grid x:Name="BetList"> <Grid.RowDefinitions> <RowDefinition Height="30"></RowDefinition> <RowDefinition Height="70"></RowDefinition> <RowDefinition Height="70"></RowDefinition> <RowDefinition Height="70"></RowDefinition> <RowDefinition Height="70"></RowDefinition> <RowDefinition Height="70"></RowDefinition> <RowDefinition Height="70"></RowDefinition> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="50*"></ColumnDefinition> <ColumnDefinition Width="70*"></ColumnDefinition> <ColumnDefinition Width="30*"></ColumnDefinition> <ColumnDefinition Width="70*"></ColumnDefinition> <ColumnDefinition Width="70*"></ColumnDefinition> <ColumnDefinition Width="70*"></ColumnDefinition> <ColumnDefinition Width="100*"></ColumnDefinition> </Grid.ColumnDefinitions> <TextBlock Text="EW" Style="{StaticResource PhoneTextNormalStyle}" Grid.Row="0" Grid.Column="4" HorizontalAlignment="Center" /> <TextBlock Text="Place" Style="{StaticResource PhoneTextNormalStyle}" Grid.Row="0" Grid.Column="5" HorizontalAlignment="Center" /> <TextBlock Text="Result" Style="{StaticResource PhoneTextNormalStyle}" Grid.Row="0" Grid.Column="6" HorizontalAlignment="Center" /> <my:OddsRow Grid.Row="1" Grid.ColumnSpan="7" Row="1"/> <my:OddsRow Grid.Row="2" Grid.ColumnSpan="7" Row="2"/> <my:OddsRow Grid.Row="3" Grid.ColumnSpan="7" Row="3"/> <my:OddsRow Grid.Row="4" Grid.ColumnSpan="7" Row="4"/> <my:OddsRow Grid.Row="5" Grid.ColumnSpan="7" Row="5"/> <my:OddsRow Grid.Row="6" Grid.ColumnSpan="7" Row="6"/> </Grid> <Grid x:Name="ControlsGrid" Grid.Row="1"> <Button x:Name="AddRowButton" Background="#BFFFFFFF" BorderBrush="#BFFFFFFF" Foreground="Black" Content="Add Row" FontSize="16" Click="AddRowButton_Click" Height="70" /> </Grid> </Grid> </ScrollViewer> </Grid> </Grid> </Grid> </phone:PhoneApplicationPage> Separately the ComboBox works, and also the code for the OddsRow works as expected... separately. When combined it doesn't display the items. OddsRow.xaml.cs public partial class OddsRow : UserControl { private int m_Row; public OddsRow() { InitializeComponent(); } public int Row { get { return m_Row; } set { m_Row = value; RowNumber.Text = m_Row + " - "; } } }

    Read the article

  • WPF List - ListItem Visibility

    - by niao
    Greetings, I have a FlowDocument where List control is placed. Inside this list I have some ListItem. Is there any way to set some kind of Visibility for specific ListItem? I don't see a coressponding Property like Visibility for ListItem. When I set fontsize="0.1" then application hangs (it goes into infinite loop).

    Read the article

  • Update Label Value in Cocos2d

    - by Viral
    hi friends I am making a game in cocos2d , In that while updating score the old score values get on the label and the new value get overwritten. I m using following code to display the score, LblScore = [CCLabel labelWithString:[NSString stringWithFormat:@"%d",score] dimensions:CGSizeMake(100, 300) alignment:UITextAlignmentCenter fontName:@"Arial" fontSize:32.0]; Because of this the score value are not shown and all things get massed up, If any one having idea how to update new score?

    Read the article

  • How to adjust padding in xaml label

    - by Bjarne
    How can I make the top and bottom padding smaller in the following label? As I see it, the bounding box in much bigger than it needs to be, but the padding is set to 0, so it cannot be any smaller. <Label Background="AliceBlue" Content="1800" FontSize="170" FontWeight="Bold" Foreground="Gray" Padding="0" />

    Read the article

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