Search Results

Search found 2453 results on 99 pages for 'xaml'.

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

  • XAML, binding Width and Height properties to the same properties of other control

    - by JAG
    I'm trying to create a reflection effect and it's working great except that I have to hard-code some values. This is my XAML: <Grid> <Grid.RowDefinitions> <RowDefinition Height="60"/> <RowDefinition /> <RowDefinition Height="80"/> </Grid.RowDefinitions> <StackPanel Grid.Row="1" VerticalAlignment="Center"> <UserControl x:Name="CurrentPresenter" /> <Border Width="500" Height="200" > <Border.Background> <VisualBrush Visual="{Binding ElementName=CurrentPresenter}" > <VisualBrush.Transform> <TransformGroup> <ScaleTransform ScaleX="1" ScaleY="-1" CenterX="500" CenterY="99" /> </TransformGroup> </VisualBrush.Transform> </VisualBrush> </Border.Background> <Border.OpacityMask> <LinearGradientBrush StartPoint="0,0" EndPoint="0,0.6"> <GradientStop Offset="-0.6" Color="Black"></GradientStop> <GradientStop Offset="0.6" Color="Transparent"></GradientStop> </LinearGradientBrush> </Border.OpacityMask> </Border> </StackPanel> </Grid> I've tried to replace Border's Width="500" and Height="200" by Width="{Binding ElementName=CurrentPresenter, Path=Width}" and Height="{Binding ElementName=CurrentPresenter, Path=Height}" but it doesn't seem to work. Wha's wrong with this code? UPDATE: If I set Width and Height here: <UserControl x:Name="CurrentPresenter" Height="200" Width="500" /> It works as expected. However it doesn't work if I set those values in the UserControl XAML. Any ideas?

    Read the article

  • How does XAML set readonly CLR properties

    - by Igor Zevaka
    I am trying to create an application bar in code for WinPhone7. The XAML that does it goes like this: <PhoneApplicationPage.ApplicationBar> <shellns:ApplicationBar Visible="True" IsMenuEnabled="True"> <shellns:ApplicationBar.Buttons> <shellns:ApplicationBarIconButton IconUri="/images/appbar.feature.search.rest.png" /> </shellns:ApplicationBar.Buttons> </shellns:ApplicationBar> </PhoneApplicationPage.ApplicationBar> So I thought I'd just rewrite it in C#: var appbar = new ApplicationBar(); var buttons = new List<ApplicationBarIconButton>(); buttons.Add(new ApplicationBarIconButton(new Uri("image.png", UrlKind.Relative)); appbar.Buttons = buttons; //error CS0200: Property or indexer 'Microsoft.Phone.Shell.ApplicationBar.Buttons' cannot be assigned to -- it is read only The only problem is that Buttons property does not have a set accessor and is defined like so: public sealed class ApplicationBar { //...Rest of the ApplicationBar class from metadata public IList Buttons { get; } } How come this can be done in XAML and not C#? Is there a special way that the objects are constructed using this syntax? More importantly, how can I recreate this in code?

    Read the article

  • WPF - Dynamically access a specific item of a collection in XAML

    - by Andy T
    Hi, I have a data source ('SampleAppearanceDefinitions'), which holds a single collection ('Definitions'). Each item in the collection has several properties, including Color, which is what I'm interested in here. I want, in XAML, to display the Color of a particular item in the collection as text. I can do this just fine using this code below... Text="{Binding Source={StaticResource SampleAppearanceDefinitions}, Path=Definitions[0].Color}" The only problem is, this requires me to hard-code the index of the item in the Definitions collection (I've used 0 in the example above). What I want to do in fact is to get that value from a property in my current DataContext ('AppearanceID'). One might imagine the correct code to look like this.... Text="{Binding Source={StaticResource SampleAppearanceDefinitions}, Path=Definitions[{Binding AppearanceID}].Color}" ...but of course, this is wrong. Can anyone tell me what the correct way to do this is? Is it possible in XAML only? It feels like it ought to be, but I can't work out or find how to do it. Any help would be greatly appreciated! Thanks! AT

    Read the article

  • Desine time XAML serialization problem in VS2010 Designer

    - by Reporting Avatar
    The wired problem is, in VS 2008, everything works fine. In VS2010 while serializing, it is missing the "ReportDimensionElements" so I'm unable to get the values back from the serialized value back from the XAML. It says, "'ReportDimensionElements' is null" am I missing anything silly. Note: I have marked the ReportDimensionElements class with [DefaultValue(null)] for avoiding {x:Null} being serialized. Will it be causing this by any way? Serialized XAML .Net 3.5 <Report> <Report.CategoricalAxis> <CategoricalAxis> <CategoricalAxis.ReportDimensionElements> <ReportDimensionElements Capacity="4"> <ReportDimensionElement DimensionName="Customer" HierarchyName="Customer Geography" LevelName="Country" /> </ReportDimensionElements> </CategoricalAxis.ReportDimensionElements> </CategoricalAxis> </Report.CategoricalAxis> </Report> .Net 4.0 <Report> <Report.CategoricalAxis> <CategoricalAxis> <CategoricalAxis.ReportDimensionElements> <ReportDimensionElement DimensionName="Customer" HierarchyName="Customer Geography" LevelName="Country" /> </CategoricalAxis.ReportDimensionElements> </CategoricalAxis> </Report.CategoricalAxis> </Report> Great Thanks

    Read the article

  • How can i navigate one xaml page to another?

    - by programmerist
    i have 2 page i need to navigate mainpage.xaml to login.page xaml but it throws me Object reference not set to an instance of an object. in Root.Children.Clear();.... i added this codes in App.xaml: private void Application_Startup(object sender, StartupEventArgs e) { Grid myGrid = new Grid(); myGrid.Children.Add(new MainPage()); this.RootVisual = myGrid; } and than i adde some codes on main.xaml to navigate to LoginUI.xaml namespace Gen.CallCenter.UI { public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); Grid Root = ((Grid)(this.Parent)); Root.Children.Clear(); Root.Children.Add(new LoginUI()); } } } How can i navigate main.xaml to LoginUI.xaml ?

    Read the article

  • Styles for XAML (Silverlight &amp; WPF)

    - by GeekAgilistMercenary
    This is a quick walk through of how to setup things for skinning within a XAML Application.  First thing, find the App.xaml file within the WPF or Silverlight Project. Within the App.xaml file set some default styles for your controls.  I set the following for a button, label, and border control for an application I am creating. Button Control <Style x:Key="ButtonStyle" TargetType="Button"> <Setter Property="FontFamily" Value="Arial" /> <Setter Property="FontWeight" Value="Bold" /> <Setter Property="FontSize" Value="14" /> <Setter Property="Width" Value="180" /> <Setter Property="Height" Value="Auto" /> <Setter Property="Margin" Value="8" /> <Setter Property="Padding" Value="8" /> <Setter Property="Foreground" Value="AliceBlue" /> <Setter Property="Background" > <Setter.Value> <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"> <GradientStop Color="Black" Offset="0" /> <GradientStop Color="#FF5B5757" Offset="1" /> </LinearGradientBrush> </Setter.Value> </Setter> </Style> Label Control <Style x:Key="LabelStyle" TargetType="Label"> <Setter Property="Width" Value="Auto"/> <Setter Property="Height" Value="28" /> <Setter Property="Foreground" Value="Black"/> <Setter Property="Margin" Value="8"/> </Style> Border Control <Style x:Key="BorderStyle" TargetType="Border"> <Setter Property="BorderThickness" Value="4"/> <Setter Property="Width" Value="Auto"/> <Setter Property="Height" Value="Auto" /> <Setter Property="Margin" Value="0,8,0,0"/> <Setter Property="CornerRadius" Value="18"/> <Setter Property="BorderBrush"> <Setter.Value> <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> <GradientStop Color="CornflowerBlue" Offset="0" /> <GradientStop Color="White" Offset="1" /> </LinearGradientBrush> </Setter.Value> </Setter> </Style> These provide good examples of setting individual properties to a default, such as; <Setter Property="Width" Value="Auto"/> <Setter Property="Height" Value="Auto" /> Also for settings a more complex property, such as with a LinearGradientBrush; <Setter Property="BorderBrush"> <Setter.Value> <LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5"> <GradientStop Color="CornflowerBlue" Offset="0" /> <GradientStop Color="White" Offset="1" /> </LinearGradientBrush> </Setter.Value> </Setter> These property setters should be located between the opening and closing <Application.Resources></Application.Resources> tags. <Application x:Class="ScorecardAndDashboard.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="MainWindow.xaml"> <Application.Resources> </Application.Resources> </Application> Now in the pages, user controls, or whatever you are marking up with XAML, for the Style Property just set a StaticResource such as shown below. <!-- Border Control --> <Border Name="borderPollingFrequency" Style="{StaticResource BorderStyle}"> <!-- Label Control --> <Label Content="Trigger Name:" Style="{StaticResource LabelStyle}"></Label> <!-- Button Control --> <Button Content="Save Schedule" Name="buttonSaveSchedule" Style="{StaticResource ButtonStyle}" HorizontalAlignment="Right"/> That's it.  Simple as that.  There are other ways to setup resource files that are separate from the App.xaml, but the App.xaml file is always a good quick place to start.  As moving the styles to a specific resource file later is a mere copy and paste. Original post is available along with other technical ramblings.

    Read the article

  • Transform XAML syntax from Shorthand to full syntax

    - by Emad
    Is there a tool or a simple way to transform XAML code from the shorthand syntax to the full syntax? For example: moving from something like: <_TextBox Text="{Binding Path=Formula.Production, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" to <_TextBox <_TextBox.Text <Binding Path="Formula.NumCloses" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" </Binding </TextBox.Text </TextBox ? Thanks

    Read the article

  • XAML ComboBox Bind to Method

    - by griegs
    If I have a method in my C#; public CollectionView Months { get { CollectionView retList = new Enumerations.Months().ToCollectionView<Enumerations.Months>(); return retList; } } And I have a ComboBox; <ComboBox x:Name="ddlMonth" Grid.Row="3" Grid.Column="1" ItemsSource="{Binding Source={StaticResource Months}}"/> How can I bind my ComboBox to my method? I should add I'm a complete xaml newbie.

    Read the article

  • XAML C# WPF Best efficient way to do an ordered sequence of animations

    - by toni
    Hi everybody! I would like to do a sequence of animations on a label, for example, first do opacity animations from values 0 to 1 and vice versa and just at the end of opacity animation and not before a foreground animation. I would like to do it in XAML code and then start and finish de animation from C# code. Which is the best and efficient way to do it? All replies are welcome! Thanks in advance.

    Read the article

  • XAML ComboBox Bind to Property

    - by griegs
    If I have a property in my C#; public CollectionView Months { get { CollectionView retList = new Enumerations.Months().ToCollectionView<Enumerations.Months>(); return retList; } } And I have a ComboBox; <ComboBox x:Name="ddlMonth" Grid.Row="3" Grid.Column="1" ItemsSource="{Binding Source={StaticResource Months}}"/> How can I bind my ComboBox to my property? I should add I'm a complete xaml newbie.

    Read the article

  • Get rid of XAML Window from Taskbar

    - by griegs
    If I have a XAML window that I show with ShowDialog, is there a way to make it (not) appear in the taskbar? The problem is that I can set the window to be topmost but if that window opens another dialog and I set that also to be topmost, I can put the second behind the first by clicking in the taskbar. This tends to confuse users.

    Read the article

  • Windows phone app xaml error

    - by thewarri0r9
    i am developing an app for windows phone 8 and i stuck on this code which visual studio showing invalid xaml. But Code compiles and works well. Invalid xaml Code is : <DataTemplate x:Key="AddrBookItemTemplate"> <StackPanel Margin="0,0,0,2" Orientation="Horizontal"> <StackPanel Width="80" Orientation="Horizontal" Height="80"> <Ellipse Margin="0" Height="70" Width="70" HorizontalAlignment="Left" Stroke="{x:Null}"> <Ellipse.Fill> <ImageBrush Stretch="Fill" ImageSource="{Binding imageBytes, Converter={StaticResource BytesToImageConverter}}"/> </Ellipse.Fill> </Ellipse> </StackPanel> <StackPanel Height="80" Margin="0" Width="380" HorizontalAlignment="Left"> <TextBlock FontWeight="Bold" Text="{Binding FirstName}" FontFamily="Segoe WP Semibold" FontSize="30" VerticalAlignment="Top" Margin="5,0,0,0" HorizontalAlignment="Left" /> <TextBlock Text="{Binding Phone}" FontFamily="Segoe WP" FontSize="24" Foreground="{StaticResource PhoneTextBoxReadOnlyBrush}" Margin="5,0,0,-12" Width="320" HorizontalAlignment="Left" VerticalAlignment="Top"/> </StackPanel> </StackPanel> </DataTemplate> I am serializing image by converting it to byte, it works fine but if image is null it gives an error. code behind: if (e.Results != null) { List<AddressBook> source = new List<AddressBook>(); foreach (var result in e.Results) { if (result.PhoneNumbers.FirstOrDefault() != null && result.GetPicture()!=null) { BitmapImage bmp = new BitmapImage(); BitmapImage nullbmp = new BitmapImage(); if (result.GetPicture() == null) { bmp.UriSource = new Uri(@"/Images/ci2.png", UriKind.RelativeOrAbsolute); } else { bmp.SetSource(result.GetPicture()); } listobj.Add(new AddressBook() { FirstName = result.DisplayName != null ? result.DisplayName : "", imageBytes = AddressBook.imageConvert(bmp), EmailAddress = "", LastName = "", Phone = result.PhoneNumbers.FirstOrDefault() != null ? result.PhoneNumbers.FirstOrDefault().PhoneNumber : "", }); } } Above code show an error "object reference not set to instance of an object". I want to show the default image (or color) in ellipse when image is null.What should I do?

    Read the article

  • #region is XAML

    - by kenny
    I actually don't link #region in my code. BUT for some reason call me crazy, I would like to have them in my XAML. I would like whole sections to have a #region-like thing and collapse them (e.g. my <Window.CommandBindings, <Grid.*Definitions, <Menu, <Toolbar, etc.. Does this exist? If not, how about <RegionCollapse

    Read the article

  • Get values from *.resx files in XAML

    - by nihi_l_ist
    Is it possible to add some value from resource file right into the XAML markup? Or for localization we always have to make something like this in *.cs file: txtMessage.Text = Messages.WarningUserMessage; Where Messages is resource, and txtMessage is TextBlock.

    Read the article

  • How to bind a ComboBox to generic dictionary with xaml code

    - by MMD MNC
    I'm using the following code : private Dictionary<string, string> GetNumber { get; set; } public ReportsLetterTra() { GetMonth = new Dictionary<string, string> { {"1", "First"}, {"2", "Second"} }; InitializeComponent(); } xaml code : <ComboBox DisplayMemberPath="value" SelectedValuePath="key" ItemsSource="{Binding ElementName=reportslettra,Path=GetNumber}" SelectedIndex="0" Name="cmbFromNumber" /> Why is not bind GetNumber to cmbFromNumber?!

    Read the article

  • WPF XAML Bind Grid

    - by Jon Archway
    I have a custom user control that is based on a Grid control. I have a ViewModel that exposes this as a property. I would like the XAML on the view to bind to this. I am sure this must be easy but I am quite new to WPF. How is this achieved? Many thanks in advance

    Read the article

  • xaml shapes - relative to canvas size

    - by taglius
    I have the need to draw shapes in XAML that are always relative to the container window/canvas size. For example, I need a window to show a 3x3 grid on it, where the grid always splits the window into 3 equal parts. Can I create lines that are bound to 1/3 the width of the grid? thank you

    Read the article

  • #region in XAML

    - by kenny
    I actually don't like #region in my code. BUT for some reason call me crazy, I would like to have them in my XAML. I would like whole sections to have a #region-like thing and collapse them (e.g. my <Window.CommandBindings, <Grid.*Definitions, <Menu, <Toolbar, etc.. Does this exist? If not, how about <RegionCollapse

    Read the article

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