Search Results

Search found 625 results on 25 pages for 'stretch'.

Page 10/25 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Wpf Combobox in Master/Detail MVVM

    - by isak
    I have MVVM master /details like this: <Window.Resources> <DataTemplate DataType="{x:Type model:EveryDay}"> <views:EveryDayView/> </DataTemplate> <DataTemplate DataType="{x:Type model:EveryMonth}"> <views:EveryMonthView/> </DataTemplate> </Window.Resources> <Grid> <ListBox Margin="12,24,0,35" Name="schedules" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=Elements}" SelectedItem="{Binding Path=CurrentElement}" DisplayMemberPath="Name" HorizontalAlignment="Left" Width="120"/> <ContentControl Margin="168,86,32,35" Name="contentControl1" Content="{Binding Path=CurrentElement.Schedule}" /> <ComboBox Height="23" Margin="188,24,51,0" Name="comboBox1" VerticalAlignment="Top" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Path=Schedules}" SelectedItem="{Binding Path=CurrentElement.Schedule}" DisplayMemberPath="Name" SelectedValuePath="ID" SelectedValue="{Binding Path=CurrentElement.Schedule.ID}" /> </Grid> This Window has DataContext class: public class MainViewModel : INotifyPropertyChanged { public MainViewModel() { _elements.Add(new Element("first", new EveryDay("First EveryDay object"))); _elements.Add(new Element("second", new EveryMonth("Every Month object"))); _elements.Add(new Element("third", new EveryDay("Second EveryDay object"))); _schedules.Add(new EveryDay()); _schedules.Add(new EveryMonth()); } private ObservableCollection<ScheduleBase> _schedules = new ObservableCollection<ScheduleBase>(); public ObservableCollection<ScheduleBase> Schedules { get { return _schedules; } set { _schedules = value; this.OnPropertyChanged("Schedules"); } } private Element _currentElement = null; public Element CurrentElement { get { return this._currentElement; } set { this._currentElement = value; this.OnPropertyChanged("CurrentElement"); } } private ObservableCollection<Element> _elements = new ObservableCollection<Element>(); public ObservableCollection<Element> Elements { get { return _elements; } set { _elements = value; this.OnPropertyChanged("Elements"); } } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } #endregion } One of Views: <UserControl x:Class="Views.EveryDayView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Grid > <GroupBox Header="Every Day Data" Name="groupBox1" VerticalAlignment="Top"> <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> <TextBox Name="textBox2" Text="{Binding Path=AnyDayData}" /> </Grid> </GroupBox> </Grid> I have problem with SelectedItem in ComboBox.It doesn't works correctly.

    Read the article

  • WPF Debugging AvalonEdit binding to Document property.

    - by kubal5003
    Hello, all day long I am sitting and trying to find out why binding to AvalonEdits Document property isn't working. AvalonEdit is an advanced WPF text editor - part of the SharpDevelop project.(it's going to be used in SharpDevelop v4 Mirador). So when I set up a simple project - one TextEditor (that's the AvalonEdits real name in the library) and made a simple class that has one property - Document and it returns a dummy object with some static text the binding is working perfectly. However in real life solution I'm binding a collection of SomeEditor objects to TabControl. TabControl has DataTemplate for SomeEditor and there's the TextEditor object. <TabControl Grid.Column="1" x:Name="tabControlFiles" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" > <TabControl.Resources> <DataTemplate DataType="{x:Type m:SomeEditor}"> <a:TextEditor Document="{Binding Path=Document, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource NoopConverter}, IsAsync=True}" x:Name="avalonEdit"></a:TextEditor> </DataTemplate> </TabControl.Resources> <TabControl.ItemContainerStyle> <Style BasedOn="{StaticResource TabItemStyle}" TargetType="{x:Type TabItem}"> <Setter Property="IsSelected" Value="{Binding IsSelected}"></Setter> </Style> </TabControl.ItemContainerStyle> </TabControl> This doesn't work. What I've investigated so far: DataContext of TextEditor is set to the proper instance of SomeEditor TextEditors Document property is set to some other instance than SomeEditor.Document property when I set breakpoint to no-op converter that is attached to that binding it shows me the correct value for Document (the converter is used!) I also dug through the VisualTree to obtain reference to TextEditor and called GetBindingExpression(TextEditor.DocumentProperty) and this did return nothing WPF produces the following information: System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=Document; DataItem='SomeEditor' (HashCode=26280264); target element is 'TextEditor' (Name='avalonEdit'); target property is 'Document' (type 'TextDocument') SomeEditor instance that is bound to already has a created and cached copy of Document before the binding occurs. The getter is never called. Anyone can tell me what might be wrong? Why BindingExpression isn't set ? Why property getter is never called?

    Read the article

  • What is the equivalent of "colspan" in an Android TableLayout?

    - by Spike Williams
    I'm using a TableLayout in Android. Right now I have one TableRow with two items in it, and, below that, a TableRow with one item it it. It renders like this: ----------------------------- | Cell 1 | Cell 2 | ----------------------------- | Cell 3 | --------------- What I want to do is make Cell 3 stretch across both upper cells, so it looks like this: ----------------------------- | Cell 1 | Cell 2 | ----------------------------- | Cell 3 | ----------------------------- In HTML I'd use a COLSPAN.... how do I make this work in Android?

    Read the article

  • How can I pass a reference to another control as an IValueConverter parameter?

    - by MKing
    I am binding some business objects to a WPF ItemsControl. They are displayed using a custom IValueConverter implementation used to produce the Geometry for a Path object in the DataTemplate as shown here: <ItemsControl x:Name="Display" Background="White" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding ElementName=ViewPlaneSelector, Path=SelectedItem.VisibleElements}" > <ItemsControl.Resources> <!-- This object is just used to get around the fact that ConverterParameter can't be a binding directly (it's not a DependencyProperty on a DependencyObject --> <this:GeometryConverterData x:Key="ConverterParameter2" Plane="{Binding ElementName=ViewPlaneSelector, Path=SelectedItem}" /> <DataTemplate DataType="{x:Type o:SlenderMember}"> <Path Stroke="Blue" StrokeThickness=".5" Data='{Binding Converter={StaticResource SlenderMemberConverter}, ConverterParameter={StaticResource ConverterParameter2}}' ToolTip="{Binding AsString}"> </Path> </DataTemplate> </ItemsControl.Resources> </ItemsControl> Note that the items for the ItemsControl are drawn from the ViewPlaneSelector (a ComboBox) SelectedItem.VisibleElements property. I need that same ViewPlaneSelector.SelectedItem in the SlenderMemberConverter to figure out how to display this element. I'm trying to get a reference to it into the converter by creating the intermediate GeometryConverterData object in the Resources section. This object exists solely to get around the problem of not being able to bind directly to the ConverterParameter property (as mentioned in the comments). Here is the code for the GeometryDataConverter class: class GeometryConverterData : FrameworkElement { public static readonly DependencyProperty PlaneProperty = DependencyProperty.Register("Plane", typeof(ViewPlane), typeof(GeometryConverterData), null, ValidValue); public static bool ValidValue(object o){ return true; } public ViewPlane Plane { get{ return GetValue(PlaneProperty) as ViewPlane; }set{ SetValue(PlaneProperty, value); } } } I added the ValidValue function for debugging, to see what this property was getting bound it. It only and always gets set to null. I know that the ViewPlaneSelector.SelectedItem isn't always null since the ItemsControl has items, and it's items are drawn from the same property on the same object... so what gives? How can I get a reference to this ComboBox into my ValueConverter. Or, alternately, why is what I'm doing silly and overly complicated. I'm as guilty as many of sometimes getting it into my head that something has to be done a certain way and then killing myself to make it happen when there's a much cleaner and simpler solution.

    Read the article

  • Stretching width correctly to 100% of an inline-block element in IE6 and IE7

    - by Simon Lieschke
    I have the following markup, where I am attempting to get the right hand side of the second table to align with the right hand side of the heading above it. This works in IE8, Firefox and Chrome, but in IE6/7 the table is incorrectly stretched to fill the width of the page. I'm using the Trip Switch hasLayout trigger to apply inline-block in IE6/7. Does anyone know how (or even if) I can get the table only to fill the natural width of the wrapper element displayed with inline-block in IE6/7? You can see the code running live at http://jsbin.com/uyuva. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Test</title> <style> .wrapper { display: inline-block; border: 1px solid green; } /* display: inline-block triggers the wrapper element to have layout for IE 6/7. The trip switch then provides the inline component of the display behaviour. See http://www.brunildo.org/test/InlineBlockLayout.html for more details. */ .wrapper { *display: inline; } table { border: 1px solid red; } </style> </head> <body> <h1>No width on table:</h1> <div class="wrapper"> <h2>The right hand side of the table doesn't stretch to the end of this heading</h2> <table><tr><td>foo</td></tr></table> </div> text <h1>Width on table:</h1> <div class="wrapper"> <h2>The right hand side of the table should stretch to the end of this heading</h2> <table style="width: 100%"><tr><td>foo</td></tr></table> </div> text </body> </html>

    Read the article

  • In WPF, What is the best way to create toolbar buttons so that the images are properly scaled?

    - by T.R.
    Specifically, I'm looking to use the 16*16 32-bit png images included with the VS2008ImageLibrary. I've tried manually setting the Height and Width attributes of the image, adjusting margins and padding, adjusting Stretch and RenderOptions. My attempts to create toolbar buttons have all led to either Improper Scaling (blurry icons), the bottom row of pixels on the icon being truncated, or the toolbar button being improperly sized - not to mention the disappearing icons already mentioned Here. Has anyone found the best way to make standard, VisualStudio/WinForms-style toolbar buttons that display properly in WPF?

    Read the article

  • Any way to simulate MouseOver in WPF

    - by jpierson
    I'm working on a link control in WPF which fits the text with icon links case in the Windows UX Guide. What I want is to have some text within a hyperlink that appears to the right of some image. In my case I started off by using a TextBlock that contained a Hyperlink which then contained my image and some text. <TextBlock> <Hyperlink> <Rectangle Height="16" Width="16" Fill="{StaticResource MyIconBrush}" Stretch="UniformToFill" VerticalAlignment="Center" HorizontalAlignment="Left" /> <Run>My link text</Run> </Hyperlink> </TextBlock> The problem with this however was that the image being taller than my text produced an effect where the text was aligned to the bottom. Unfortunately I haven't found any way to control the vertical alignment within the TextBlock or within the Hyperlink so I've resorted to attempting an alternative layout where the Hyperlink and the Rectangle that represent my vector icon are separated in order to get them to align properly like shown below. <TextBlock> <Hyperlink> <StackPanel Orientation="Horizontal"> <Rectangle Height="16" Width="16" Fill="{StaticResource MyIconBrush}" Stretch="UniformToFill" VerticalAlignment="Center" HorizontalAlignment="Left" /> <TextBlock VerticalAlignment="Center"><Hyperlink>My link text<Hyperlink></TextBlock> </StackPanel> </Hyperlink> </TextBlock> The problem with this however is that now that my Icon and my Hyperlink are separated I don't get my MouseOver appearance of my link when I the mouse is over my icon and vise-versa. So this got me to thinking, how do I simulate MouseOver for a given control such with a checkbox where you get the MouseOver effect on the box when you actually mouse over it's associated text. I know in the HTML world the label element has a for attribute that can be used to specify which control it is labeling which will basically do what I'm looking for. Also I can imagine that in other scenarios it may be nice to have a label that when you mouse over shows a corresponding text box as if the mouse is over it and possibly when clicked focus is given to the corresponding text box as well. For now though I'm interested mainly in how to to get a label or label like element in WPF to act as a proxy for a given control in terms of it's MouseOver state. Also I would like to do this purely in XAML if possible.

    Read the article

  • Programming Related Songs

    - by Jim McKeeth
    One song per answer please! We have discussed music you listen to while coding, but I looking for music related to coding and coders. It can be eclectic or mainstream, and even a bit of a stretch (just explain the connection). Vote for your favorite song or add it if it isn't already here. Link to lyrics, band, music, video, etc., when possible.

    Read the article

  • Silverlight - Image Not Loading from URI at Runtime!?

    - by Sootah
    I've added an image element to my Silverlight app, and while the image pulls right up when in design mode, it doesn't load at all when running the app. Code is: <Image Height="95" HorizontalAlignment="Left" Margin="12,541,0,0" Name="imgBannerAd" Stretch="Fill" VerticalAlignment="Top" Width="828" Source="http://myurl.com/images/theimage.png" /> What's the deal? I'd tried running the file via the local hard drive and localhost, neither has any effect.

    Read the article

  • How to tile the contents of a CALayer?

    - by iaefai
    I would like to tile a CGImage across a CALayer, but it seems to only want to stretch it. The example code: self.background = [UIImage imageNamed: @"Background.png"]; [documentDisplay.layer setContents: self.background.CGImage]; I would like to avoid subclassing if I could.

    Read the article

  • GridLayout with single column

    - by Albinoswordfish
    Right now I'm trying to use a GridLayout with only a single column. However I'm having a problem where I don't want the object, in this case a JButton, to be stretched the entire width of the JPanel that it's on. Is there a way to decrease the width of the JButton so that it does not stretch the entire width of the JPanel. I've tried using setPreferredSize and setSize with no results. Is this just the way GridLayout works or is there something I'm missing?

    Read the article

  • Loading an external image via XAML code in WPF?

    - by Mohammad
    I have an image lock.png beside of my WPF exe file in the images folder. Now, I'm gonna load it into the WPF Project as an image, I've used the following XAML code: <Image Stretch="Fill" Source="pack://siteoforigin:,,,/images/lock.png" /> It works, but Expression Blend or Visual Studio doesn't show it when I'm working on the project. How can we show external images in these situations?

    Read the article

  • 9patch border issues

    - by synic
    Is there a trick to making 9patch images with single pixel borders? I'm not talking about the single pixel black borders that you use to define the stretchable and content areas. I'm talking about the image itself. If I create an image that has a 1 pixel border around it, often times android will pick one of the edges and stretch it to 2 (or sometimes more) pixels, even though I specifically left the edges out of the stretchable area in the draw9patch utility.

    Read the article

  • Creating a Custom UIButton.

    - by Joshua
    I am looking to create a Custom UIButton (not subclass) progrmatically, I would like it to have a background image that will stretch as the UIButton's width increases. How would I do this?

    Read the article

  • Jquery and frames

    - by Shard
    I am currently working on a web application that has been created using a magnitude of frames that stretch down up to 5 times, The issue is that i need to preform some jquery magic throughout the website. What would be the best way to go about this (other than rewriting it which i have considered)? EDIT: The Frame Structure is something along the lines of this: Index.html menu.html banner.html list.html footer.html /lib/index.html header.html body.html footer.html The magic i am referencing is a few hot key shortcuts, find and replace that kind of stuff

    Read the article

  • WPF Linear Fill

    - by Ben
    Hi, I have found some example code that creates a gradient fill in a WPF rectangle control: <Rectangle Height="{Binding ElementName=txtName}" Width="{Binding ElementName=txtName}"> <Rectangle.Fill> <LinearGradientBrush> <GradientStop Color="Silver" Offset="0.0" /> <GradientStop Color="Black" Offset="0.5" /> <GradientStop Color="white" Offset="1.0" /> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> I have some written some code that displays a collection of ListBox's that contain details from MyObject: <UserControl.Resources> <DataTemplate x:Key="CustomerTemplate"> <Border BorderThickness="2" BorderBrush="Silver" CornerRadius="5" Padding="1" Height="50"> <Grid x:Name="thisGrid"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" /> </Grid.ColumnDefinitions> <StackPanel Orientation="Horizontal" > <Image Source="C:\MyImage.jpg" Height="50" Width="100" ></Image> </StackPanel> <Border Grid.Column="1" Margin="0" Padding="0"> <StackPanel Orientation="Vertical"> <TextBlock Name="txtName" Text="{Binding Name}" Background="Silver" Foreground="Black" FontSize="16" FontWeight="Bold" Height="25"/> </StackPanel> </Border> </Grid> </Border> </DataTemplate> </UserControl.Resources> <ListBox ItemsSource="{Binding}" ItemTemplate="{StaticResource CustomerTemplate}" Name="grdList" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" > </ListBox> I would like to apply the same stlye of fill that i get with the first example, in each of my ListBox's. I can't quite figure out how to do this. Can anyone help? Thanks

    Read the article

  • How to play small sound file continuously in Silverlight?

    - by ash
    Hello, I have two questions regarding Silverlight's SoundPlay action and properties. My scenario is like: I have two story board: The first story board has an image and a sound file; when the silverlight application gets loaded, the sound starts to play automatically, but if someone clicks the image, the sound file will stop and the second storyboard will start with a new sound file. 1) My first question is how to stop the first sound file of first story board when the second story board starts with the second sound file. 2) My second question is how to play a sound file continuously; for example, in Silverlight we can play a story board continuously with RepeatBehavior="Forever"; but I cannot find a way to play my 10 second sound file forever or continuously. Note: I have attached a small XAML file to show what I am talking about; I am also stating that if instead of an image file, if there were a button, then I can stop the first music file after I click the button and start my second story board with a new sound file, but I would like to use image file instead of a button. Is it possible? If it is, how to do it? Therefore, please answer my following two questions or give big hint or website tutorial links on 1) How to stop the first sound file of first story board when the second story board starts with the second sound file ( When the clickable element is an image instead of a button) 2) How to play a 10 second sound file continuously? ............Code Snippet...................... XAML ............ <Grid x:Name="LayoutRoot" Background="Red"> <Button HorizontalAlignment="Left" Margin="212,0,0,111" VerticalAlignment="Bottom" Width="75" Content="Button" Click="onClick"/> <MediaElement x:Name="sound2_mp3" Height="0" HorizontalAlignment="Left" Margin="105,230,0,0" VerticalAlignment="Top" Width="0" Source="/sound2.mp3" Stretch="Fill"/> <MediaElement x:Name="sound1_mp1" Height="0" HorizontalAlignment="Left" Margin="190,164,0,0" VerticalAlignment="Top" Width="0" Source="/sound1.mp3" Stretch="Fill" AutoPlay="False"/> </Grid> ..................................................................................................................................................................................................................... using System; using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Ink; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Shapes; namespace testPrj { public partial class MainPage : UserControl { public MainPage() { // Required to initialize variables InitializeComponent(); } private void onClick(object sender, System.Windows.RoutedEventArgs e) { Storyboard1.Stop(); sound2_mp3.Stop(); sound1_mp1.Play(); } } } ...................................................................................................

    Read the article

  • How to learn using Hadoop

    - by ajay
    hi, I want to learn hadoop. However, I don't have access to a cluster now. Is it possible for me to learn it and use it for writing programs and learn it properly. Would it be helpful to run multiple linux VMs and then use them as boxes to run hadoop? Or you think that is more of a stretch and running it on a multiple hosts is the same as running in on single host (in terms of setup, Hadoop API used, the architecture of the map-reduce programs etc) Thanks,

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >