Search Results

Search found 10936 results on 438 pages for 'wpf controls'.

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

  • C#/WPF - RoutedEvent in WPF class that isn't a UIElement

    - by Andreas
    I have a class that needs to notify that something significant has occured. The class is in a WPF-project, even though this specific class, is lookless (and doesn't inherit from UIElement, neither directly or indirectly). Normally, I just register a RoutedEvent to get this functionality but as this class neither has AddHandler nor RemoveHandler, I can't get it to work. Anyone knows of another way of get the RoutedEvent behaviour?

    Read the article

  • WPF 3D - converting from Point2D to Point3D and back again

    - by DanM
    I'm new to WPF 3D, so I may just be missing something obvious, but how would I go about converting from a 2D coordinate to a 3D coordinate and back again? I'd like the 2D coordinate to be the location measured from the upper-left corner of Viewport3D and the 3D coordinate to be the location relative to the origin (0, 0, 0) of the 3D world. The conversion functions should have these signatures: public Point3D Point2DAndWorldZToPoint3D(Point2D point2D, double worldZ) // usually I want to know where a 2D point will be on the ground plane // so worldZ will usually be zero (but not always) public Point2D Point3DToPoint2D(Point3D point3D) I found this related question, but it only addresses conversion from 3D to 2D (not the reverse), and I'm not sure if the answers are up-to-date. Note, I'm currently using .NET 3.5, but if there are improvements in .NET 4.0 that would help me, please let me know.

    Read the article

  • WPF Window Style not working at runtime

    - by Christian Pena
    Hi, I created a WPF application in Visual Studio 2010 Express (C#) and added the text below to the Application.Resources in App.xaml. I see the style applied to the window in the designer, but when I run the application, the window background is white. Running in Windows XP on BootCamp on a MacBook Pro if that is a factor. Thanks in advance, Christian <Style TargetType="{x:Type Window}"> <Setter Property="Background"> <Setter.Value> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop Offset="0" Color="WhiteSmoke" /> <GradientStop Offset="1" Color="Silver" /> </LinearGradientBrush> </Setter.Value> </Setter> <Setter Property="Padding" Value="20" /> </Style>

    Read the article

  • EventTrigger RoutedEvent in wpf xaml

    - by Cinaird
    I have a problem in wpf xaml and i'm pretty new on this so it may be something basic i want to rotate a ellipse 360 degree <Ellipse Name="test" Fill="Black" StrokeThickness="5" Margin="0,0,0,0" Height="66"> <Ellipse.Triggers> <EventTrigger RoutedEvent="Ellipse.Loaded" SourceName="test"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="test" Storyboard.TargetProperty="(Ellipse.RenderTransform).(RotateTransform.Angle)" From="0" To="360" Duration="0:0:0.5" RepeatBehavior="1x" /> </Storyboard> </BeginStoryboard> </EventTrigger> </Ellipse.Triggers> </Ellipse> But nothing happens, what is wrong?

    Read the article

  • WPF 3D - Need help writing conversion methods between 2D and 3D (Point3DToPoint and PointAndZToPoint

    - by DanM
    I'm new to WPF 3D, so I may just be missing something obvious, but how do I convert from 3D to 2D and (for a given z location) from 2D to 3D? Specifically, I need two conversion methods: Point3DToPoint - If I have an (x, y, z) coordinate in the 3D world, how do I determine the (x, y) coordinate on the projected 2D surface. Method signature: public Point Point3DToPoint(Point3D point3D) PointAndZToPoint3D - If I have an (x, y) coordinate on the projected 2D surface and a z location in the 3D world, how do I determine the intersecting (x, y, z) coordinate in the 3D world? Method signature: public Point3D PointAndZToPoint3D(Point point, double z) I'd like the 2D coordinate to be the location measured from the upper-left corner of Viewport3D and the 3D coordinate to be the location relative to the origin (0, 0, 0) of the 3D world. Note 1: I found this related question, but it only addresses conversion from 3D to 2D (not the reverse), and I'm not sure if the answers are up-to-date. Note 2: I'm currently using .NET 3.5, but if there are improvements in .NET 4.0 that would help me, please let me know.

    Read the article

  • WPF: How do I debug binding errors?

    - by Jonathan Allen
    I'm getting this in my output Window: System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'ListBoxItem' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment') This is my XAML, which when run looks correct <GroupBox Header="Grant/Deny Report"> <ListBox ItemsSource="{Binding Converter={StaticResource MethodBinder}, ConverterParameter=GrantDeny, Mode=OneWay}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <Label Content="{Binding Entity}"/> <Label Content="{Binding HasPermission}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> </GroupBox>

    Read the article

  • wpf toolkit (Feb 2010) datagrid with MVVM - style reveals name of view model on 'spare column'

    - by Andy Clarke
    Hi, I've just updated my app with the latest WPF toolkit and I've now got an issue with my styling. When I bind some data with, for example, two columns to the grid, the spare area at the right shows the name of the ViewModel in the header. I can understand why, because the data grids data context is the ViewModel and I'm defining my header style as follows ... <WpfToolkit:DataGridHeaderBorder <Border BorderBrush="Blue" BorderThickness="0,1,0,0"> <TextBlock Text="{Binding}" Margin="4,0,4,0" /> </Border> </WpfToolkit:DataGridHeaderBorder> Do I now need a separate style for the 'spare column' or something? Can anyone assist please? Cheers, Andy

    Read the article

  • How to Animate a Gradient on a Path to visualize data flow in WPF/WCF app

    - by John
    I have an interesting project where several "nodes" on a cnavas are connected via a Path similiar to a mindmap tree. The path is used to visualize the connection state between two nodes. Red means the nodes are disconnected, green means they're connected. The next step would be to illustrate data flow (from A to B or B to A) using that path and an animation. Basically I would want to start the animation with the data transfer and stop it when the transfer is complete. Does anyone know how this could be done in WPF?

    Read the article

  • WPF Hide DataGridColumn via a binding

    - by Greg R
    For some reason I can't hide WPF Toolkit's DataGridColumn. I am trying to do the following: <dg:DataGridTemplateColumn Header="Item Description" Visibility="{Binding IsReadOnly}"> <dg:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBox Text="{Binding Path=ItemDescription}" /> </DataTemplate> </dg:DataGridTemplateColumn.CellTemplate> This doesn't work, since it's looking for a IsReadOnly property on the ItemSource (not a property of the current class). If add this as a property of the ItemSource class that implements INoifyPropertyChanged, it still doesn't hide the column. Is there a way around this? I want the column to hid when a button click changes IsReadOnly property. Assume IsReadOnly returns a Visibility value and is a dependency property I am completely stuck, I would really appreciate the help! Thanks a lot!

    Read the article

  • WPF MenuItem ViewModel Command

    - by Jon Archway
    Hi, I am fairly new to WPF and am struggling a little with a scenario. I have a menu which has menu items. When one of these menu items gets clicked a method needs to be called that will do something based upon the text displayed associated with that menu item. So for example, the menu item's content was "test" so I would need to do something with "test". FYI, this "something" directly affects a collection on the ViewModel. This is easy to achieve using the click event and no ViewModel, but I was trying to implement MVVM using an explicit ViewModel. So I started to look into Commands but cannot see how I would pass anything from the View back into the Command in the ViewModel. Any suggestions on what I should be doing here? Thanks

    Read the article

  • WPF - Have a list source defined at runtime but still have sample data for design time

    - by Vaccano
    I have some ListBoxes in my WPF app. I would like to be able to view how the design looks with out having to run the app. But I still want to be able to bind to ItemsSource to my View Model. I know I saw a blog post on how to do this, but I cannot seem to find it now. To reiterate, I want dummy data at design time, but real data at run time and not break the MVVM pattern. Any ideas?

    Read the article

  • Navigate between screens in WPF

    - by Greg R
    This should be a very basic design question, but for some reason it doesn't seem to be well documented (maybe due to its simplicity?). If I'm building a dashboard application in WPF that brig up different CRM tasks and I want to navigate between screens, is this the best way to do this, or is there a better way? So for example I have Log In Screen - Main Menu Screen - Screen to one of different utilities var orderManagerWindow = new MyXamlView(); var loginWindow = Application.Current.MainWindow; orderManagerWindow.Left = loginWindow.Left; orderManagerWindow.Top = loginWindow.Top; Application.Current.MainWindow = orderManagerWindow; orderManagerWindow.Show(); loginWindow.Close(); I would really appreciate help and suggestions!

    Read the article

  • WPF Binding issues

    - by Nitin Chaudhari
    I have WPF window which binds a local Dependency property to a property of my usercontrol. So now I see the value which the window gave me in my usercontrol. I achieve this by setting DataContext of window to the window itself Now once the window is loaded i set the DataContext of usercontrol to a ViewModel class, and at some point of time(based on user action) the control changes values in the control. All fine so far. But now the changed value is not reflected in Windows dependency property. How I can resolve this issue?

    Read the article

  • Setting the background color of WPF TabControl inactive tabs

    - by David Veeneman
    Is there a simple way to set the background brush of all inactive tabs in a WPF TabControl? I want to emulate the look of VS 2010 on a TabControl--the background color of the control's inactive tabs should match the background color of the window in which the TabControl is sited, so that you see only the text of the tab, and not the tab itself. I know it will take a ControlTemplate to do it; I am trying to figure out what to put in the control template. Put another way, How do I specify that a particular brush should be applied to all inactive tabs? Thanks for your help.

    Read the article

  • how to bind to the results of a query in WPF

    - by randyc
    I have a query that hits a service and returns the results back to me as an indexed collection static void QueryActivities() { QueryClient qc = new QueryClient("BasicHttpBinding_IQuery"); QueryFilter filter = new QueryFilter(); filter.CallForService = false; var result = qc.GetFilteredActivityIndex(filter); result.Clone(); //inserted this just to test return in debug mode } WHen this is executed I get a return of 5 records ( actually five rows of data with multiple values per each row. id, type, date, address etc). I would like to bind this return to a gridview within a WPF application. Is there a way to refernce and bind to result variable or do I need to create a new collection and then add the return of result to the new collection? thank you

    Read the article

  • Binding a slider value on the height of its thumb in WPF

    - by sofri
    Hi, I have a databinding problem in WPF. I would like to "customise" a slider in a way that the thumb grows when you move the slider to the right and the thumb shrinks when you move the slider to the left. So I edited the template for the slider and changed the look of the slider so the slider looks like I want it to. But now I have to bind the height of the thumb to the value of the slider but I do not know how that works. I did some simple data binding things but I cannot figure out how I can bind this "thumb height" that's inside of my slider's template to the slider's value that's inside the User Control where my slider is in. So how can I do it?

    Read the article

  • WPF, animate over container boundaries

    - by ImIan
    Hi, I'm learning WPF and have a specific goal. Imagine you have a grid (3 rows by 3 columns), and a control, say a simple blue rectangle fills the middle cell. When I click on the cell I want the square to rotate smoothly through 180 degrees. The specific issue I have at the moment is; as the rectangle rotates, it won't change its dimensions, so it will extend beyond the boundary of the cell. I don't want it to clip, i want it to appear on top, partially obscuring surrounding cells. The second part of this is, if there is one cell that fills the entire window, and I click on the blue rectangle in that cell, can I make the rectangle rotate and extend beyond the sides of the form? If that doesn't make sense, please ask. I'm finding it hard to google because I don't know the exact terms I should be using. Thank you

    Read the article

  • WPF TreeView binding to a simple object

    - by esse
    I have a simple object as such: public class Info { public string Name {get; set;} public int Count {get; set;} public DateTime TimeStamp {get; set;} } I want to bind a collection of these objects to a WPF TreeView and have the properties on the Info objects show up as sub TreeViewItems, like so: Item 1 Name: Bill Count: 3 TimeStamp: 12/05/2010 09:06:00 AM Item 2 Name: Chris Count: 22 TimeStamp: 11/05/2010 11:34:00 AM Item 3 Name: Toby Count: 1 TimeStamp: 09/05/2010 05:55:00 PM How can I achieve this through XAML?

    Read the article

  • Splitting up/merging windows in WPF

    - by drasto
    I'm new to WPF but I need to implement following functionality: I have a window that contains one Grid (might be changed to stack panel or something else). In that Grid I have 2 columns, each of them contains another Grid. Lets call them gridFirst and gridSecond. There is also GridSplitter in first column allowing to resize the columns. I want to provide a button that will allow to separate gridFirst from this window and display it "as it is" in another window. How do I do that? It would be nice if the new window had a same menu as the original window without me having to copy-paste (that not a good coding practise) all its code to the new window. Thanks for answers

    Read the article

  • Wrapping WPF UserControl inside VisualStudio Item Template

    - by karthik84
    I am currently started working on a project which will allow users to design reports inside visual studio. Previously, for my similar Winforms App, I had extended the IComponent (Component Class) and wrote our VS Like designer kind of custom control which will allow users to drag drop controls from the visual studio toolbox and then I export it as a VisualStudio C#&VB ItemTemplate. Now I am trying to recreate the same control using WPF considering its power, extensiblity. Could anyone shed some lights on this, on what would be the most preferable way of doing this ? Thanks in advance.

    Read the article

  • adding row dyanamicaly to gridview in WPF

    - by user572914
    Please help me with the following code,I want to add a row inputted by user to a gridview. I am able to add a row but its empty!!Please help.it worked in windows forms but its not working with WPF. private void button1_Click(object sender, RoutedEventArgs e) { GetGridView(); } private void GetGridView() { string[] row0 = {textBox1.Text,"Beatles" }; dataGrid1.Items.Add(row0); dataGrid1.Columns[0].DisplayIndex = 0; dataGrid1.Columns[1].DisplayIndex = 1; } ////////////// sure,here it is

    Read the article

  • Adding a textblock to a custom wpf control (piepiece control from codeplex)

    - by bomortensen
    Hi Stackoverflow! I'm currently building a Surface application where the main navigation is a circular menu. For each menu item I'm using a custom control that I found on codeproject.com: http://www.codeproject.com/KB/WPF/PieChartDataBinding.aspx (PiePiece control) The number of submenu items (which is also piepiece controls) comes from a database and thus dynamically loaded. What I can't figure out is how I add a textblock to this custom control to display the submenu item text. It needs to follow the PiePiece's RotationAngle property to line up correctly. Anyone got a hot-fix for this? I was thinking about adding another dependencyproperty to the piepiece custom control, but that way I can't set the font-family, size etc (can I?) Any input on this is greatly appreciated! Thanks!

    Read the article

  • Control to Control Binding in WPF/Silverlight

    - by psheriff
    In the past if you had two controls that you needed to work together, you would have to write code. For example, if you want a label control to display any text a user typed into a text box you would write code to do that. If you want turn off a set of controls when a user checks a check box, you would also have to write code. However, with XAML, these operations become very easy to do. Bind Text Box to Text Block As a basic example of this functionality, let’s bind a TextBlock control to a TextBox. When the user types into a TextBox the value typed in will show up in the TextBlock control as well. To try this out, create a new Silverlight or WPF application in Visual Studio. On the main window or user control type in the following XAML. <StackPanel>  <TextBox Margin="10" x:Name="txtData" />  <TextBlock Margin="10"              Text="{Binding ElementName=txtData,                             Path=Text}" /></StackPanel> Now run the application and type into the TextBox control. As you type you will see the data you type also appear in the TextBlock control. The {Binding} markup extension is responsible for this behavior. You set the ElementName attribute of the Binding markup to the name of the control that you wish to bind to. You then set the Path attribute to the name of the property of that control you wish to bind to. That’s all there is to it! Bind the IsEnabled Property Now let’s apply this concept to something that you might use in a business application. Consider the following two screen shots. The idea is that if the Add Benefits check box is un-checked, then the IsEnabled property of the three “Benefits” check boxes will be set to false (Figure 1). If the Add Benefits check box is checked, then the IsEnabled property of the “Benefits” check boxes will be set to true (Figure 2). Figure 1: Uncheck Add Benefits and the Benefits will be disabled. Figure 2: Check Add Benefits and the Benefits will be enabled. To accomplish this, you would write XAML to bind to each of the check boxes in the “Benefits To Add” section to the check box named chkBenefits. Below is a fragment of the XAML code that would be used. <CheckBox x:Name="chkBenefits" /> <CheckBox Content="401k"           IsEnabled="{Binding ElementName=chkBenefits,                               Path=IsChecked}" /> Since the IsEnabled property is a boolean type and the IsChecked property is also a boolean type, you can bind these two together. If they were different types, or if you needed them to set the IsEnabled property to the inverse of the IsChecked property then you would need to use a ValueConverter class. SummaryOnce you understand the basics of data binding in XAML, you can eliminate a lot code. Connecting controls together is as easy as just setting the ElementName and Path properties of the Binding markup extension. NOTE: You can download the complete sample code at my website. http://www.pdsa.com/downloads. Choose Tips & Tricks, then "SL – Basic Control Binding" from the drop-down. Good Luck with your Coding,Paul Sheriff ** SPECIAL OFFER FOR MY BLOG READERS **Visit http://www.pdsa.com/Event/Blog for a free eBook on "Fundamentals of N-Tier".

    Read the article

  • Custom Checkbox style for WPF

    - by lorddarq
    I would like to skin a wpf default checkbox to something custom. Since it does not really make sense to start off a entirely new control, i'd like to override the Windows Chrome template binding for the Bulletchrome sub component of the checkbox. However I cannot do this like I can with checkboxes for example. tried using something like this to override the default style, but it seems to not compile like this <Style x:Key="cb_BULLETSTYLE" TargetType="{x:Type BulletDecorator}"> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type BulletDecorator}"> <Border x:Name="Chrome" SnapsToDevicePixels="true" BorderBrush="{x:Null}" BorderThickness="0"> </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" TargetName="Chrome" Value="#FF4C4C4C"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter>

    Read the article

  • Binding Image.Source to String in WPF ?

    - by Mohammad
    I have below XAML code : <Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" DataContext="{Binding RelativeSource={RelativeSource Self}}" WindowStartupLocation="CenterScreen" Title="Window1" Height="300" Width="300"> <Grid> <Image x:Name="TestImage" Source="{Binding Path=ImageSource}" /> </Grid> </Window> Also, there is a method that makes an Image from a Base64 string : Image Base64StringToImage(string base64ImageString) { try { byte[] b; b = Convert.FromBase64String(base64ImageString); MemoryStream ms = new System.IO.MemoryStream(b); System.Drawing.Image img = System.Drawing.Image.FromStream(ms); ////////////////////////////////////////////// //convert System.Drawing.Image to WPF image System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img); IntPtr hBitmap = bmp.GetHbitmap(); System.Windows.Media.ImageSource imageSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions()); Image wpfImage = new Image(); wpfImage.Source = imageSource; wpfImage.Width = wpfImage.Height = 16; ////////////////////////////////////////////// return wpfImage; } catch { Image img1 = new Image(); img1.Source = new BitmapImage(new Uri(@"/passwordManager;component/images/TreeView/empty-bookmark.png", UriKind.Relative)); img1.Width = img1.Height = 16; return img1; } } Now, I'm gonna bind TestImage to the output of Base64StringToImage method. I've used the following way : public string ImageSource { get; set; } ImageSource = Base64StringToImage("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAABjUExURXK45////6fT8PX6/bTZ8onE643F7Pf7/pDH7PP5/dns+b7e9MPh9Xq86NHo947G7Hm76NTp+PL4/bHY8ojD67rc85bK7b3e9MTh9dLo97vd8/D3/Hy96Xe76Nfr+H+/6f///1bvXooAAAAhdFJOU///////////////////////////////////////////AJ/B0CEAAACHSURBVHjaXI/ZFoMgEEMzLCqg1q37Yv//KxvAlh7zMuQeyAS8d8I2z8PT/AMDShWQfCYJHL0FmlcXSQTGi7NNLSMwR2BQaXE1IfAguPFx5UQmeqwEHSfviz7w0BIMyU86khBDZ8DLfWHOGPJahe66MKe/fIupXKst1VXxW/VgT/3utz99BBgA4P0So6hyl+QAAAAASUVORK5CYIII").Source.ToString(); but nothing happen. How can I fix it ? BTW, I'm dead sure that the base64 string is correct

    Read the article

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