Search Results

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

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

  • Tools\addin's for formating or cleaning up xaml?

    - by cody
    I'm guessing these don't exist since I searched around for these but I'm looking for a few tools: 1) A tool that cleans up my xaml so that the properties of elements are consistent through a file. I think enforcing that consistence would make the xaml easier to read. Maybe there could be a hierarchy of what comes first but if not alphabetical might work. Example before: TextBox Name="myTextBox1" Grid.Row="3" Grid.Column="1" Margin="4" TextBox Grid.Column="1" Margin="4" Name="t2" Grid.Row="3" Example after: TextBox Name="myTextBox1" Grid.Row="3" Grid.Column="1" Margin="4" TextBox Name="t2" Grid.Row="3" Grid.Column="1" Margin="4" (note < / has been remove from the above since control seem to have issues parsing whe the after section was added) 2) Along the same lines as above, to increase readability, a tool to align properties, so from the above code example similar props would start in the same place. <TextBox Name="myTextBox1" Grid.Row="3" Grid.Column="1" Margin="4"/> <TextBox Name="t2" Grid.Row="3" Grid.Column="1" Margin="4"/> I know VS has default settings for XAML documents so props can be on one line or separate lines so maybe if there was a tool as described in (1) this would not be needed...but it would still be nice if you like your props all on one line. 3) A tool that adds X to the any of the Grid.Row values and Y to any of the Grid.Column values in the selected text. Every time I add a new row\column I have to go manually fix these. From my understanding Expression Blend can help with this but seem excessive to open Blend just to increment some numbers (and just don't grok Blend). Maybe vs2010 with the designer will help but right now I'm on VS08 and Silverlight. Any one know of any tools to help with this? Anyone planning to write something like this...I'm looking at you JetBrains and\or DevExpress. Thanks.

    Read the article

  • Silverlight 4 XAML Collections

    - by mattduffield
    Hello, I have authored some custom classes that I would like to create using XAML: <Grid Width="300" Height="300"> <l:DashboardTable> <l:DashboardTable.DashboardTableQuery> <dq:DashboardTableQuery ConnectionString="Data Source=bunkerhill;Initial Catalog=emgov_data;User Id=emgovadmin;Password=p@$$word;" Query="select datename(month, cr_tb_DateDue) AS Month, sum(cr_tb_AmountTransaction) AS Total from cr_tb_transactionbill where Year(cr_tb_DateDue) = 2005 and Month(cr_tb_DateDue) IN (1,2,3,4) group by datename(month, cr_tb_DateDue)" > <dq:DashboardTableQuery.DataColumns> <dq:DataColumn ColumnName="Month" ColumnOrder="0" Label="Month" /> <dq:DataColumn ColumnName="Total" ColumnOrder="1" Label="Total" /> </dq:DashboardTableQuery.DataColumns> </dq:DashboardTableQuery> </l:DashboardTable.DashboardTableQuery> </l:DashboardTable> </Grid> The problem is that I get a XamlParseException when I try to run this XAML. I have determined it is when it gets to the dq:DataColumn element. It seems like this is only happening when I have a property that then has a collection and then several items in the collection that I am getting this issue. Has any encountered anything similar? I am try to achieve this all in XAML declaratively.

    Read the article

  • Changing color of HighlighBrushKey in XAML

    - by phil
    Hi, I have the following problem. The background color in a ListView is set LightGreen or White, whether a boolflag is true or false. Example Screen Window1.xaml: <Window.Resources> <Style TargetType="{x:Type ListViewItem}"> <Style.Triggers> <DataTrigger Binding="{Binding Path=BoolFlag}" Value="True"> <Setter Property="Background" Value="LightGreen" /> </DataTrigger> </Style.Triggers> </Style> </Window.Resources> <StackPanel> <ListView ItemsSource="{Binding Path=Personen}" SelectionMode="Single" SelectionChanged="ListViewSelectionChanged"> <ListView.View> <GridView> <GridViewColumn DisplayMemberBinding="{Binding Path=Vorname}" Header="Vorname" /> <GridViewColumn DisplayMemberBinding="{Binding Path=Nachname}" Header="Nachname" /> <GridViewColumn DisplayMemberBinding="{Binding Path=Alter}" Header="Alter" /> <GridViewColumn DisplayMemberBinding="{Binding Path=BoolFlag}" Header="BoolFlag" /> </GridView> </ListView.View> </ListView> </StackPanel> Window1.xaml.cs: public partial class Window1 : Window { private IList<Person> _personen = new List<Person>(); public Window1() { _personen.Add(new Person { Vorname = "Max", Nachname = "Mustermann", Alter = 18, BoolFlag = false, }); _personen.Add(new Person { Vorname = "Karl", Nachname = "Mayer", Alter = 27, BoolFlag = true, }); _personen.Add(new Person { Vorname = "Josef", Nachname = "Huber", Alter = 38, BoolFlag = false, }); DataContext = this; InitializeComponent(); } public IList<Person> Personen { get { return _personen; } } private void ListViewSelectionChanged(object sender, SelectionChangedEventArgs e) { Person person = e.AddedItems[0] as Person; if (person != null) { if (person.BoolFlag) { this.Resources[SystemColors.HighlightBrushKey] = Brushes.Green; } else { this.Resources[SystemColors.HighlightBrushKey] = Brushes.RoyalBlue; } } } } Person.cs: public class Person { public string Vorname { get; set; } public string Nachname { get; set; } public int Alter { get; set; } public bool BoolFlag { get; set; } } Now I want to set the highlight color of the selected item, depending on the boolflag. In Code-Behind I do this with: private void ListViewSelectionChanged(object sender, SelectionChangedEventArgs e) { Person person = e.AddedItems[0] as Person; if (person != null) { if (person.BoolFlag) { this.Resources[SystemColors.HighlightBrushKey] = Brushes.Green; } else { this.Resources[SystemColors.HighlightBrushKey] = Brushes.RoyalBlue; } } } } This works fine, but now I want to define the code above in the XAML-file. With <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Green" /> I can overwrite the default-value. However, it works, but the color is set to Green for all selected items. I have tried different ways to switch the color of HighlightBrushKey between Green and Blue in XAML, depending on the boolflag, but I didn't succeed. May you can help me and give me some examples?

    Read the article

  • Setting an XAML Window always on top (but no TopMost property)

    - by Brian Scherady
    I am developing an application based on OptiTrack SDK (from NaturalPoint). I need to run the application window as "Always on Top". The window is designed in XAML and is controled in the class "CameraView" but it does not seem to include a "TopMost" property or equivalent. Attached are the code of "CameraView.xaml.cs" and the code of "CameraView.xaml" that are part of OptiTrack SDK (NaturalPoint) called "Single_Camera_CSharp_.NET_3.0". One could expect the class CameraView to contain properties or members to set the position of the window on the screen or to set it to TopMost but as far as searched I found nothing. I wonder what I should do. Thank you, Brian ================ "CameraView.xaml.cs" using System; using System.IO; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Media; using System.Windows.Media.Animation; using System.Windows.Navigation; using System.Drawing.Imaging; using System.Drawing.Drawing2D; using System.Windows.Threading; namespace TestProject { public partial class CameraView { private const int NP_OPTION_OBJECT_COLOR_OPTION = 3; private const int NP_OPTION_VIDEO_TYPE = 48; private const int NP_OPTION_NUMERIC_DISPLAY_ON = 71; private const int NP_OPTION_NUMERIC_DISPLAY_OFF = 72; private const int NP_OPTION_FETCH_RLE = 73; private const int NP_OPTION_FETCH_GRAYSCALE = 74; private const int NP_OPTION_FRAME_DECIMATION = 52; private const int NP_OPTION_INTENSITY = 50; private const int NP_OPTION_SEND_EMPTY_FRAMES = 41; private const int NP_OPTION_THRESHOLD = 5; private const int NP_OPTION_EXPOSURE = 46; private const int NP_OPTION_SEND_FRAME_MASK = 73; private const int NP_OPTION_TEXT_OVERLAY_OPTION = 74; // public delegate void OnCameraViewCreate(CameraView camera); // public static OnCameraViewCreate onCameraViewCreate; private System.Drawing.Bitmap raw = new System.Drawing.Bitmap(353, 288, System.Drawing.Imaging.PixelFormat.Format32bppArgb); private int mFrameCounter; private int mDisplayCounter; private DispatcherTimer timer1 = new DispatcherTimer(); private bool mVideoFrameAvailable = false; private int mNumeric = -1; private bool mGreyscale = false; private bool mOverlay = true; public CameraView() { this.InitializeComponent(); timer1.Interval = new TimeSpan(0, 0, 0, 0, 10); timer1.Tick += new EventHandler(timer1_Tick); } public int Numeric { get { return mNumeric; } set { mNumeric = value % 100; if (mNumeric = 0) { if (Camera != null) Camera.SetOption(NP_OPTION_NUMERIC_DISPLAY_ON, value % 100); } } } private bool CameraRunning = false; private OptiTrack.NPCamera mCamera; public OptiTrack.NPCamera Camera { get { return mCamera; } set { if (mCamera == value) return; //== Don't do anything if you're assigning the same camera == if (mCamera != null) { //== Shut the selected camera down ==<< if (CameraRunning) { CameraRunning = false; mCamera.Stop(); mCamera.FrameAvailable -= FrameAvailable; } } mCamera = value; if (mCamera == null) { mNumeric = -1; } else { serialLabel.Content = "Camera "+mCamera.SerialNumber.ToString(); //mNumeric.ToString(); } } } private void FrameAvailable(OptiTrack.NPCamera Camera) { mFrameCounter++; try { OptiTrack.NPCameraFrame frame = Camera.GetFrame(0); int id = frame.Id; if (CameraRunning) { GetFrameData(Camera, frame); } frame.Free(); } catch (Exception) { int r = 0; r++; } } private void GetFrameData(OptiTrack.NPCamera camera, OptiTrack.NPCameraFrame frame) { BitmapData bmData = raw.LockBits(new System.Drawing.Rectangle(0, 0, raw.Width, raw.Height), ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppArgb); int stride = bmData.Stride; System.IntPtr bufferPtr = bmData.Scan0; unsafe { byte* buffer = (byte*)(void*)bufferPtr; camera.GetFrameImage(frame, bmData.Width, bmData.Height, bmData.Stride, 32, ref buffer[0]); } raw.UnlockBits(bmData); mVideoFrameAvailable = true; } private void timer1_Tick(object sender, EventArgs e) { if (CameraRunning && mVideoFrameAvailable) { mVideoFrameAvailable = false; cameraImage.Source = Img(raw); mDisplayCounter++; } } private System.Windows.Media.ImageSource Img(System.Drawing.Bitmap img) { System.Drawing.Imaging.BitmapData bmData = img.LockBits(new System.Drawing.Rectangle(0, 0, img.Width, img.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppPArgb); System.Windows.Media.Imaging.BitmapSource bitmap = System.Windows.Media.Imaging.BitmapSource.Create( img.Width, img.Height, 96, 96, PixelFormats.Bgra32, System.Windows.Media.Imaging.BitmapPalettes.WebPalette, bmData.Scan0, bmData.Stride * bmData.Height, bmData.Stride); img.UnlockBits(bmData); return bitmap; } private void startStopButton_Click(object sender, RoutedEventArgs e) { if (CameraRunning) StopCamera(); else StartCamera(); } public void StartCamera() { if (Camera != null) { mFrameCounter = 0; mDisplayCounter = 0; Camera.FrameAvailable += FrameAvailable; Camera.SetOption(NP_OPTION_VIDEO_TYPE, 0); Camera.SetOption(NP_OPTION_FRAME_DECIMATION, 1); Camera.SetOption(NP_OPTION_INTENSITY, 0); Camera.SetOption(NP_OPTION_EXPOSURE, 10); Camera.SetOption(NP_OPTION_THRESHOLD, 50); Camera.SetOption(NP_OPTION_OBJECT_COLOR_OPTION, 0); SetOverlayOption(); SetGreyscaleOption(); timer1.Start(); Camera.Start(); CameraRunning = true; this.Numeric = mNumeric; startStopButton.Content = "Stop Camera"; } } private void SetGreyscaleOption() { if(mGreyscale) Camera.SetOption(NP_OPTION_VIDEO_TYPE, 1); else Camera.SetOption(NP_OPTION_VIDEO_TYPE, 0); } private void SetOverlayOption() { if(mOverlay) Camera.SetOption(NP_OPTION_TEXT_OVERLAY_OPTION, 255); else Camera.SetOption(NP_OPTION_TEXT_OVERLAY_OPTION, 0); } public void StopCamera() { if (Camera != null) { Camera.Stop(); timer1.Stop(); CameraRunning = false; Camera.FrameAvailable -= FrameAvailable; Camera.SetOption(NP_OPTION_NUMERIC_DISPLAY_OFF, 0); startStopButton.Content = "Start Camera"; } } private void greyscaleButton_Click(object sender, RoutedEventArgs e) { if(mGreyscale) mGreyscale = false; else mGreyscale = true; SetGreyscaleOption(); } private void OverlayButton_Click(object sender, RoutedEventArgs e) { if(mOverlay) mOverlay = false; else mOverlay = true; SetOverlayOption(); } private void exposureSlider_ValueChanged(object sender, RoutedEventArgs e) { if (mCamera!=null) { mCamera.SetOption(NP_OPTION_EXPOSURE, (int) this.exposureSlider.Value); } } private void thresholdSlider_ValueChanged(object sender, RoutedEventArgs e) { if (mCamera != null) { mCamera.SetOption(NP_OPTION_THRESHOLD, (int)this.thresholdSlider.Value); } } private void optionsButton_Click(object sender, RoutedEventArgs e) { if (!propertyPanel.IsVisible) propertyPanel.Visibility = Visibility.Visible; else propertyPanel.Visibility = Visibility.Collapsed; } } } ================ "CameraView.xaml"

    Read the article

  • Resharper doesn't play well with XAML?

    - by John Weldon
    I've been noticing a pattern with ReSharper (both 4.5 and 5). Very often (almost always) when I have solution-wide analysis turned on, and WPF code in my solution, ReSharper will mark a number of the .xaml.cs files as being broken. When I navigate to the file, sometimes it magically updates and displays no errors, and other times I have to open other files that are not being correctly read and close them again to force resharper to correctly analyze them. I assume it has something to do with the temporary .cs code that is generated with XAML, but does anyone know why this is actually happening, and if there is a work around? Should I just file a bug report with JetBrains? Does anyone else experience this?

    Read the article

  • WPF Error when implementing Login.xaml

    - by LnDCobra
    I am getting the following exception: "Nullable object must have a value" Everything was working when I was using StartupURI="MainWindow.xaml" but I wanted to implement a login screen so I changed this to Startup="Application_Startup" and then created the following method in App.xaml.cs: private void Application_Startup(object sender, StartupEventArgs e) { UpdateAccounts(); bool result = true; ///* LoginWindow login = new LoginWindow(); result = login.ShowDialog().Value; /* */ if (!result) { return; } MainWindow window = new MainWindow(); bool main = window.ShowDialog().Value; } Does anyone have any idea what is going on? Or any suggestions on what is the best practice for implementing login interface.

    Read the article

  • How to Debug XAML Parsing Errors in Silverlight?

    - by Nick Gotch
    I run into the following issue semi-regularly: I make changes to XAML or some resources used by it and when I go to load up the Silverlight project in debug mode it only gets as far as the spinning Silverlight-loading animation. I've tried attaching the VS08 debugger to the process but it doesn't do anything at this point (works fine once I'm in the Silverlight but not before.) From previous experience I've noticed this happens when there're problems with the XAML or the resources in it but my only solution so far has been to dissect the code line-by-line until I spot the problem. Is there an easy way to debug/diagnose these situations? UPDATE I found this question with some help, but it still doesn't provide a good way to debug these types of issues.

    Read the article

  • xaml nested class path designer issue

    - by Vlad Bezden
    Hi, I have nested class public class Enums { public enum WindowModeEnum { Edit, New } } In my xaml I reference code: <Style.Triggers> <DataTrigger Binding="{Binding WindowMode}" Value="{x:Static Types1:Enums+WindowModeEnum.Edit}"> <Setter Property="Visibility" Value="Collapsed" /> </DataTrigger> </Style.Triggers> Code compiles and runs properly, however I can't open xaml code in design window. I am getting following error: Type 'Types1:Enums+WindowModeEnum' was not found. at MS.Internal.Metadata.ExposedTypes.ValueSerializers.StaticMemberDocumentValueSerializer.ConvertToDocumentValue(ITypeMetadata type, String value, IServiceProvider documentServices) at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlMarkupExtensionPropertyBase.get_Value() at MS.Internal.Design.DocumentModel.DocumentTrees.DocumentPropertyWrapper.get_Value() at MS.Internal.Design.DocumentModel.DocumentTrees.InMemory.InMemoryDocumentProperty..ctor(DocumentProperty property, InMemoryDocumentItem item) at MS.Internal.Design.DocumentModel.DocumentTrees.InMemory.InMemoryDocumentItem.SetUpItem(DocumentItem item) Same error exist in VS2008, VS2010. Does anybody has any idea, how to deal with it so I can open window in design mode. Thanks a lot. Sincerely, Vlad.

    Read the article

  • Hidden features of WPF and XAML?

    - by Sauron
    Here is a large number of hidden features discussed for variety of languages. Now I am curious about some hidden features of XAML and WPF? One I have found is the header click event of a ListView <ListView x:Name='lv' Height="150" GridViewColumnHeader.Click="GridViewColumnHeaderClickedHandler"> The GridViewColumnHeader.Click property is not listed. Some of relevant features so far: Multibinding combined with StringFormat TargetNullValue to bindings TextTrimming property Markup extensions Adding Aero effect to Window Advanced "caption" properties XAML Converters See also: Hidden features of C# Hidden features of Python Hidden features of ASP.NET Hidden features of Perl Hidden features of Java Hidden features of VB.NET Hidden features of PHP Hidden features of Ruby Hidden features of C And So On........

    Read the article

  • Selecting a UserControl from XAML

    - by kmontgom
    I'm working on a problem right now where I need to embed a UserControl inside another UserControl. But, I need to determine at runtime which embedded UserControl to instantiate. This implies to me that some form of data binding and/or template selection mechanism has to be invoked, but I'm not sure how to proceed with the pure XAML approach. If I was to do this with code, I would define some sort of container control in the parent UserControl, and then in the code-behind, implement some logic which would instantiate the appropriate child UserControl and then insert it as Content into the specified container in the parent UserControl. Can this be done using only XAML, or is some sort of code-behind required?

    Read the article

  • How to send a list of object from my MainPage.xaml to another page

    - by LivingThing
    When navigating to another page how can i make my list of object available to another page. for example in my mainpage.xaml var data2 = from query in document.Descendants("weather") select new Forecast { date = (string)query.Element("date"), tempMaxC = (string)query.Element("tempMaxC"), tempMinC = (string)query.Element("tempMinC"), weatherIconUrl = (string)query.Element("weatherIconUrl"), }; forecasts = data2.ToList<Forecast>(); .... NavigationService.Navigate(new Uri("/WeatherInfoPage.xaml", UriKind.Relative)); and then in my other class, i want to make it available so that i can use it like this private void AddPageItem(List<Forecast> forecasts) { .. }

    Read the article

  • Displaying a list of Items in a WPF form using XAML

    - by Dave Colwell
    Hi guys, I am attempting to display a list of items (the style and controltemplate for these items are defined elsewhere) and i want to be able to add/remove as many as i want to. As i do not have infinite screen realestate I am displaying these in a ListBox control. This is the screen i have to date: What is going to happen is this. When i click the New button, i want the item to appear in the outlined area. So now for the problem: I want, when i click the New... Button, a new item to appear in the ListBox (outlined). Is it possible to do this using XAML? I am trying to work on seperating the business logic from the interface, so if there were some way to acheive this in XAML i would appreciate it. If not,can i use the custom templated item i have created in C# so that it will appear as the template specifies in the list box instead of like a normal ListBoxItem Thanks in advance!

    Read the article

  • Bogus WPF / XAML errors in Visual Studio 2010

    - by epalm
    There are bogus errors hanging around, but at runtime everything works. Right now, I'm getting Cannot locate resource 'img/icons/silk/arrow_refresh.png'. I've got a simple UserControl called ImageButton (doesn't everyone?): <UserControl x:Class="WinDispatchClientWpf.src.controls.ImageButton" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d"> <Button Name="btnButton" Click="btnButton_Click"> <StackPanel Orientation="Horizontal"> <Image Name="btnImage" Stretch="None" /> <TextBlock Name="btnText" /> </StackPanel> </Button> </UserControl> Which does what you'd expect: [ContentProperty("Text")] public partial class ImageButton : UserControl { public String Image { set { btnImage.Source = GuiUtil.CreateBitmapImage(value); } } public String Text { set { btnText.Text = value; } } public double Gap { set { btnImage.Margin = new Thickness(0, 0, value, 0); } } public bool ToolBarStyle { set { if (value) { btnButton.Style = (Style)FindResource(ToolBar.ButtonStyleKey); } } } public bool IsCancel { set { btnButton.IsCancel = value; } } public bool IsDefault { set { btnButton.IsDefault = value; } } public event RoutedEventHandler Click; public ImageButton() { InitializeComponent(); } private void btnButton_Click(object sender, RoutedEventArgs e) { if (Click != null) { Click(sender, e); } } } Where CreateBitmapImage is the following: public static BitmapImage CreateBitmapImage(string imagePath) { BitmapImage icon = new BitmapImage(); icon.BeginInit(); icon.UriSource = new Uri(String.Format("pack://application:,,,/{0}", imagePath)); icon.EndInit(); return icon; } I can't see the design view of any xaml file that uses an ImageButton like such: <Window foo="bar" xmlns:wpfControl="clr-namespace:MyProj.src.controls"> <Grid> <wpfControl:ImageButton ToolBarStyle="True" Gap="3" Click="btnRefresh_Click" Text="Refresh" Image="img/icons/silk/arrow_refresh.png" /> </Grid> </Window> Why is VS complaining?

    Read the article

  • Binding a combobox in XAML to a childwindow property

    - by AlexB
    Hi, I want to display a child window that contains a combobox with several values coming from one of the child window's property: public partial class MyChildWindow : ChildWindow { private ObservableCollection<MyClass> _collectionToBind = // initialize and add items to collection to make sure it s not empty... public ObservableCollection<MyClass> CollectionToBind { get { return _collectionToBind; } set { _collectionToBind = value; } } } How do I bind in XAML my combobox to the ComboBoxContent collection (both are in the same class)? I've tried several things such as: <ComboBox x:Name="linkCombo" ItemsSource="{Binding Path=CollectionToBind }" DisplayMemberPath="Description"> I've only been able to bind it in the code behind file and would like to learn the XAML way to do it. Thank you!

    Read the article

  • Binding PropertyName of CollectionViewSource SortDescription in Xaml

    - by Faisal
    Here is my xaml that tells the collectionviewsource sort property name. <CollectionViewSource Source="{Binding Contacts}" x:Key="contactsCollection" Filter="CollectionViewSource_Filter"> <CollectionViewSource.SortDescriptions> <scm:SortDescription PropertyName="DisplayName" /> </CollectionViewSource.SortDescriptions> </CollectionViewSource> The xaml above works fine but problem I have is that I don't know how to give a variable value to SortDescription PropertyName. I have a property in my viewmodel that tells which property to sort on but I am not able to bind this property to SortDescription's PropertyName field. Is there any way?

    Read the article

  • The type{0} does not support direct content - WPF / XAML

    - by Levo
    Hi there: I defined in my code two classes: a "Person" class with public "Age" and "Name" property, and a "People" class that inherits from Generic.List(of T). The code for People class is as followed: Public Class People Inherits Collections.Generic.List(Of Person) ... End Class What I want to achieve is to directly initialize the People class, and add individual Person to it in XAML, i.e.: <local:People x:Key="Familty"> <local:Person Age="11" Name="John" /> <local:Person Age="12" Name="John2" /> ... </local:People> But I keep getting an error in XAML saying: The type 'People' does not support direct content. Any idea as for how to solve this problem? Thank you very much!

    Read the article

  • XAML Converter ConvertBack

    - by MFH
    Is there a way to access the ConvertBack-Method of a Converter that implements IValueConverter directly from XAML? The basic situation is the following (relationsships): Route (1)<->(CN) Training (1)<->(CN) Kilometer The DataContext is set to a Training. From here I use the Convert-Method to access all my Kilometers. I also have a Converter from Route to IList<Training> and the ConvertBack would lookup the Route for a Training. But I seem to not be able to access that Method from XAML…

    Read the article

  • WPF Creating an instance of a class in xaml

    - by Cloverness
    Hi, I have a problem with creating the instance of a class in xaml file. I thought you can do it like this: in the resource part of the user control and then use it in the xaml file (for example bind to it). But even tough the class I created is located in the same namespace it says that: "The type was not found. Verfiy that all assemblies were built, etc". How to get it right? is there another method? Thanks for suggestions.

    Read the article

  • XAML Binding to property

    - by imslavko
    I have check box in my XAML+C# Windows Store application. Also I have bool property: WindowsStoreTestApp.SessionData.RememberUser which is public and static. I want check box's property IsChecked to be consistent (or binded, or mapped) to this bool property. I tried this: XAML <CheckBox x:Name="chbRemember1" IsChecked="{Binding Mode=TwoWay}"/> C# chbRemember1.DataContext = SessionData.RememberUser; Code for property: namespace WindowsStoreTestApp { public class SessionData { public static bool RememberUser { get; set; } } } But it doesn't seem to work. Can you help me?

    Read the article

  • Visualising a 'Smarties' lid using XAML (WPF/Silverlight, Visual Studio/Blend)

    - by Mr. Disappointment
    Hi folks, First off, to clarify something in the title which could well be ambiguous/misleading, I'd like to inform you of my definition of 'Smarties', as I know often products are available all over - only under a different alias. Smarties are a candy product in the UK, little chocolate drops covered in a crispy shell which are distributed in a card tube, this tube used to have a plastic lid/top with an individual letter on the underside (they've taken a more economical approach as of late), the lid/top of the old-style tube is the main element of this question. Familiarisation Link Lid View Link Okay, now with the seller-type pitch out of the way (no, I don't work for Nestlé ;)), hopefully the question is becoming rather clear. Essentially, I'd like to recreate one of these lids using XAML, ultimately to be utilised in a Silverlight web application. That is, I'd like to result in a reusable control, of which the following is true: It looks like a Smarties lid. The colour can be specified. The letter can be specified. The control can be rotated to display either side. The second two seem trivial, but we must bare in mind that the background colour specified will almost, if not always, be the same as the foreground, leaving a visibility issue where the character content is concerned; as for the rotation, I'm hoping this kind of functionality is reasonably available, and acceptable to implement. So, to put this out there, consider a control named SmartiesLid which derives from ToggleButton (appropriate?) and further plotted out using a style in a resource dictionary which applies to it, as follows: <Style TargetType="local:SmartiesLid"> <Setter Property="Background" Value="Red"/> <Setter Property="Foreground" Value="Red"/> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:SmartiesLid"> <Grid x:Name="LayoutRoot"> <Grid.ColumnDefinitions> <ColumnDefinition Width=".05*"/> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition Width=".05*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height=".05*"/> <RowDefinition/> <RowDefinition/> <RowDefinition Height=".05*"/> <RowDefinition Height=".1*"/> </Grid.RowDefinitions> <Ellipse Grid.RowSpan="4" Grid.ColumnSpan="4" Fill="{TemplateBinding Background}" Stroke="Transparent"/> <Ellipse Grid.RowSpan="2" Grid.ColumnSpan="2" Grid.Column="1" Grid.Row="1" Fill="{TemplateBinding Background}" Stroke="Transparent"> <Ellipse.Effect> <DropShadowEffect Direction="280" ShadowDepth="6" BlurRadius="6"/> </Ellipse.Effect> </Ellipse> <TextBlock Grid.RowSpan="2" Grid.ColumnSpan="2" Grid.Column="1" Grid.Row="1" Name="LetterTextBlock" Text="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" FontSize="190" HorizontalAlignment="Center" VerticalAlignment="Center"> </TextBlock> <!-- <Path Stretch="Fill" Grid.Row="3" Grid.RowSpan="2" Grid.Column="1" Grid.ColumnSpan="2" Fill="Black" Data="..."> How to craw the lid 'tab'? </Path> --> </Grid> <ControlTemplate.Resources> <TranslateTransform x:Key="IndentTransform" X="10" /> <RotateTransform x:Key="RotateTransform" Angle="0" /> <Storyboard x:Key="MouseOver"> </Storyboard> <Storyboard x:Key="MouseLeave"> </Storyboard> </ControlTemplate.Resources> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Trigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource MouseOver}"/> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard Storyboard="{StaticResource MouseLeave}"/> </Trigger.ExitActions> </Trigger> <Trigger Property="IsPressed" Value="true"> <Setter TargetName="LayoutRoot" Property="RenderTransform" Value="{StaticResource IndentTransform}"/> </Trigger> <Trigger Property="IsChecked" Value="true"> <Setter TargetName="LayoutRoot" Property="RenderTransform" Value="{StaticResource RotateTransform}"/> </Trigger> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Foreground" Value="Gray"/> <Setter Property="Opacity" Value="0.5"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> With this in mind, can anyone give input on, in decreasing order of my incompetence in an area: Designing the overall look and feel of the damn thing (I'm no designer, and while I could hack away at this single control for days and potentially get something relatively useful, it's always a gamble). The particular barrier for me here is 'pathing' the tab of the lid, as you will see in the XAML as an element commented out. Should Path be used, or would it be more appropriate to transform a rectangle with rounded corners, or any specific suggestions? Bevelling the individually displayed letter; as detailed above, when the colour of both the foreground and background are the same then this will be invisible if no effects are applied, also for a decent level of realism I'd like to be able to apply such an effect/s. So far use of DropShadow and Balder3DEngine have fulfilled my requirements for graphics in XAML, how achievable is a bevel effect? Rotating the control on mouse-click, that is, showing the opposing face. Is this going to be possible using a style and XAML only for the design? Or is it that ugliness may rear it's head in the form of code-behind to show/hide embedded controls? Should the faces be separate controls and later somehow combined? Allowing the control to size dynamically. I'm supposing I will be able to convert a solid, absolute layout to a nice generic one when I actually have the former in place. Obviously this entails sizing the centralised letter and the lid 'tab', but that's it really, other than keeping the aspect ratio equal (since the ellipses grow nicely with the grid). Any suggestions to approaching this would be greatly appreciated, particularly with a dynamically growing font - I've done that before in a web-imaging scenario using code and System.Drawing, and wouldn't like to approach it in even a similar way. By the way, the reason I specify both WPF and Silverlight is that, from my current knowledge, the inputs being written targeting either of these will be fairly transferable for similar output by the other, albeit not without alterations in either scenario. The resulting application is in fact destined to be written in Silverlight, however, so I don't fancy inviting anything from WPF which will guarantee my only being able to convert 90% of it. I'll go give this little project a start, maybe in Blend(?), hopefully can catch up with some advice shortly. Thanks, Mr. D EDIT: Next question, ought this to be broken up into separate questions? :/

    Read the article

  • XAML Deserialization problem

    - by mrwayne
    Hi, I have a block of XAML of which i'm trying to deserialize. For arguments sake lets say it looks like below. <NS:SomeObject> <NS:SomeObject.SomeProperty> <NS:SomeDifferentObject SomeOtherProp="a value"/> </NS:SomeObject.SomeProperty> </NS:SomeObject> Of which i deserialise using the following code. XamlReader.Load( File.OpenRead( @"c:\SomeFile.xaml")) I have 2 solutions, one i use Unit Testing, and another i have for my web application. When i'm using the unit testing solution, it deserializes fine and works as expected. However, when i try to deserialize using my other project i keep getting an exception like the following. 'NameSpace.SomeObject' value cannot be assigned to property 'SomeProperty' of object 'NameSpace.SomeObject'. Object of Type 'NameSpace.SomeObject' cannot be converted to type 'NameSpace.SomeObject'. It's as if it is getting confused or instantiating 2 different types of objects? Note, i do not have similarly named classes or any sort of namespace conflict. The same codes executes fine in one solution and not the other. The same project files are referenced in both. Please help!

    Read the article

  • Binding ListBox to List (Collection) in XAML

    - by david2tm
    Hello, I'm learning WPF, so I'm kind of n00b in this. I saw some examples about how to do what I want to do, but nothing exactly... The question: I want to bind List to ListBox. I want to do it in XAML, w/o coding in code behind. How can I achieve that? Right now I do it that way: <!-- XAML --> <ListBox x:Name="FileList"> <ListBox.ItemTemplate> <DataTemplate> <Label Content="{Binding Path=.}"/> </DataTemplate> </ListBox.ItemTemplate> </ListBox> // Code behind public MainWindow() { // ... files = new List<string>(); FileList.ItemsSource = files; } private void FolderBrowser_TextChanged(object sender, RoutedEventArgs e) { string folder = FolderBrowser.Text; files.Clear(); files.AddRange(Directory.GetFiles(folder, "*.txt", SearchOption.AllDirectories)); FileList.Items.Refresh(); } But I want to get rid of FileList.ItemsSource = files; and FileList.Items.Refresh(); in C# code. Thanks

    Read the article

  • New TabItem Content ActualHeight crashes Xaml Window

    - by Jack Navarro
    I am able to create new TabItems with Content dynamically to a new window by streaming the Xaml with XamlReader: NewWindow newWindow = new NewWindow(); newWindow.Show(); TabControl myTabCntrol = newWindow.FindName("GBtabControl") as TabControl; StringReader stringReader = new StringReader(XamlGrid); XmlReader xmlReader = XmlReader.Create(stringReader); TabItem myTabItem = new TabItem(); myTabItem.Header = qDealName; myTabItem.Content = (UIElement)XamlReader.Load(xmlReader); myTabCntrol.Items.Add(myTabItem); This works fine. It displays a new grid wrapped in a scrollviewer. The problem is access the TabItem content from the newWindow. TabItem ti = GBtabControl.SelectedItem as TabItem; string scrollvwnm = "scrollViewer" + ti.Header.ToString(); MessageBox.Show(ti.ActualHeight.ToString()); // returns 21.5 ScrollViewer scrlvwr = this.FindName(scrollvwnm) as ScrollViewer; MessageBox.Show(scrollvwnm); // Displays name double checked for accuracy MessageBox.Show(scrlvwr.ActualHeight.ToString()); //Crashes ScrollViewer scrlvwr = ti.FindName(scrollvwnm) as ScrollViewer; MessageBox.Show(scrollvwnm); // Displays name double checked for accuracy MessageBox.Show(scrlvwr.ActualHeight.ToString()); //Also Crashes Is there a method to refresh UI in XAML so the new window is able to access the newly loaded tab item content? Thanks

    Read the article

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