Search Results

Search found 9012 results on 361 pages for 'wpf binding'.

Page 17/361 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Button template with image and text in wpf

    - by Archana R
    Hello, I want to create buttons with images and text inside. For example, i would use different images and text for buttons like 'Browse folders' and 'Import'. One of the options would be to use a template. I had a look at simliar question http://stackoverflow.com/questions/1933127/creating-an-imagetext-button-with-a-control-template But is there any way by which i can bind the source of image without using a dependency property or any other class? Thanks

    Read the article

  • Search and Highlight search text in items in the Listview in WPF

    - by kiran-k
    Hi, I am using MVVM to show the database records in a gridview (ListView view). i have a textbox where we can enter the text to be searched in the results listed in the gridview. i tried many ways to highlight the search text (Not the entire row only the text matches in the record) in the records displayed in the list view but unable to highlight. i am able to find the starting and ending indexes. i tried to created rectangles using those indexes on the text block but unable to highlight. Can anyone have solution for this. Thanks in advance.

    Read the article

  • checkbox like radiobutton wpf c#

    - by rockenpeace
    i have investigated this problem but this is solved in design view and code-behind. but my problem is little difference: i try to do this as only code-behind because my checkboxes are dynamically created according to database data.In other words, number of my checkboxes is not stable. i want to check only one checkbox in group of checkboxes. when i clicked one checkbox,i want that ischecked property of other checkboxes become false.this is same property in radiobuttons. i take my checkboxes from a stackpanel in xaml side: <StackPanel Margin="4" Orientation="Vertical" Grid.Row="1" Grid.Column="1" Name="companiesContainer"> </StackPanel> my xaml.cs: using (var c = new RSPDbContext()) { var q = (from v in c.Companies select v).ToList(); foreach (var na in q) { CheckBox ch = new CheckBox(); ch.Content = na.Name; ch.Tag = na; companiesContainer.Children.Add(ch); } } foreach (object i in companiesContainer.Children) { CheckBox chk = (CheckBox)i; chk.SetBinding(ToggleButton.IsCheckedProperty, "DataItem.IsChecked"); } how can i provide this property in checkboxes in xaml.cs ? thanks in advance..

    Read the article

  • WPF: change DataTemples according to Value

    - by Kave
    I have a class called Cell with two properties. One is called Value of type int? And the other is called Candidates of type ObservableCollection during the initialization I am utilizing a DataTemplateSelector to choose between two datatemplates for two different scenarios. If the Value property has a value then template A should be used to present the Cell class. However if the Value property is null Then template B should be used to present the Cell class. While this works perfectly fine during the initialization however during the runtime the templates don't change any more when the value of the Value property actually changes. Is the approach of using DataTemplateSelector the wrong approach to change DataTemplates dynamically? What would you recommend I should do? Many thanks,

    Read the article

  • WPF DataGrid bind data between columns

    - by Markus2k
    Lets say I have 2 columns in my data Grid: Column A: Selected, and Column B: Name. The Selected column is a checkbox. And Name column is text field. I want to set the color of the text in 'Name' column as Blue if Column A's check box is checked, and Red otherwise. Essentially I don't know how to bind data between columns of the datagrid. And sample code/link providing example would be useful.

    Read the article

  • WPF ListView as a DataGrid – Part 3

    - by psheriff
    I have had a lot of great feedback on the blog post about turning the ListView into a DataGrid by creating GridViewColumn objects on the fly. So, in the last 2 parts, I showed a couple of different methods for accomplishing this. Let’s now look at one more and that is use Reflection to extract the properties from a Product, Customer, or Employee object to create the columns. Yes, Reflection is a slower approach, but you could create the columns one time then cache the View object for re-use. Another potential drawback is you may have columns in your object that you do not wish to display on your ListView. But, just because so many people asked, here is how to accomplish this using Reflection.   Figure 1: Use Reflection to create GridViewColumns. Using Reflection to gather property names is actually quite simple. First you need to pass any type (Product, Customer, Employee, etc.) to a method like I did in my last two blog posts on this subject. Below is the method that I created in the WPFListViewCommon class that now uses reflection. C#public static GridView CreateGridViewColumns(Type anyType){  // Create the GridView  GridView gv = new GridView();  GridViewColumn gvc;   // Get the public properties.  PropertyInfo[] propInfo =          anyType.GetProperties(BindingFlags.Public |                                BindingFlags.Instance);   foreach (PropertyInfo item in propInfo)  {    gvc = new GridViewColumn();    gvc.DisplayMemberBinding = new Binding(item.Name);    gvc.Header = item.Name;    gvc.Width = Double.NaN;    gv.Columns.Add(gvc);  }   return gv;} VB.NETPublic Shared Function CreateGridViewColumns( _  ByVal anyType As Type) As GridView  ' Create the GridView   Dim gv As New GridView()  Dim gvc As GridViewColumn   ' Get the public properties.   Dim propInfo As PropertyInfo() = _    anyType.GetProperties(BindingFlags.Public Or _                          BindingFlags.Instance)   For Each item As PropertyInfo In propInfo    gvc = New GridViewColumn()    gvc.DisplayMemberBinding = New Binding(item.Name)    gvc.Header = item.Name    gvc.Width = [Double].NaN    gv.Columns.Add(gvc)  Next   Return gvEnd Function The key to using Relection is using the GetProperties method on the type you pass in. When you pass in a Product object as Type, you can now use the GetProperties method and specify, via flags, which properties you wish to return. In the code that I wrote, I am just retrieving the Public properties and only those that are Instance properties. I do not want any static/Shared properties or private properties. GetProperties returns an array of PropertyInfo objects. You can loop through this array and build your GridViewColumn objects by reading the Name property from the PropertyInfo object. Build the Product Screen To populate the ListView shown in Figure 1, you might write code like the following: C#private void CollectionSample(){  Product prod = new Product();   // Setup the GridView Columns  lstData.View =      WPFListViewCommon.CreateGridViewColumns(typeOf(Product));  lstData.DataContext = prod.GetProducts();} VB.NETPrivate Sub CollectionSample()  Dim prod As New Product()   ' Setup the GridView Columns  lstData.View = WPFListViewCommon.CreateGridViewColumns( _       GetType(Product))  lstData.DataContext = prod.GetProducts()End Sub All you need to do now is to pass in a Type object from your Product class that you can get by using the typeOf() function in C# or the GetType() function in VB. That’s all there is to it! Summary There are so many different ways to approach the same problem in programming. That is what makes programming so much fun! In this blog post I showed you how to create ListView columns on the fly using Reflection. This gives you a lot of flexibility without having to write extra code as was done previously. NOTE: You can download the complete sample code (in both VB and C#) at my website. http://www.pdsa.com/downloads. Choose Tips & Tricks, then "WPF ListView as a DataGrid – Part 3" 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

  • Alpha issue with SharpDX SpriteBatch in WPF

    - by Kingdom
    .Hi devs, I'm coding a game using SharpDX in a WPF context. void Load() { sb = new SpriteBatch(GraphicsDevice); t2d = Content.Load<Texture2D>("Sprite.png"); } void Draw() { sb.Begin(); sb.Draw(t2d, new Rectangle(0, 0, 64, 64), Color.White); sb.End(); } I made Sprite.png, an object with pink color (alpha = 0%) for the background. The output show me my object but with the pink square at more or less 50% rate! So if I try to draw more sprites, it's like a little poney dream. Note If I apply Color.Black on the Draw method, the sprite is like expected :|

    Read the article

  • IntelliTrace Causing Slow WPF Debugging in Visual Studio 2010

    - by WeigeltRo
    Just a quick note to myself (and others that may stumble across this blog entry via a web search): If a WPF application is running slow inside the debugger of Visual Studio 2010, but perfectly fine without a debugger (e.g. by hitting Ctrl-F5), then the reason may be Intellitrace. In my case switching off Intellitrace (only available in the Ultimate Edition of Visual Studio 2010) helped gitting rid of the sluggish behavior of a DataGrid. In the “Tools” menu select “Options”, on the Options dialog click “Intellitrace” and then uncheck “Enable Intellitrace”. Note that I do not have access to Visual Studio 2012 at the time of this writing, thus I cannot make a statement about its debugging behavior.

    Read the article

  • Databinding to an Entity Framework in WPF

    - by King Chan
    Is it good to use databinding to Entity Framework's Entity in WPF? I created a singleton entity framework context: To have only one connection and it won't open and close all the time. So I can pass the Entity around to any class, and can modify the Entity and make changes to the database. All ViewModels getting the entity out from the same Context and databinding to the View saves me time from mapping new object, but now I imagine there is problem in not using the newest Context: A ViewModel databinding to a Entity, then someone else updated the data. The ViewModel will still display the old data, because the Context is never being dispose to refresh. I always create new Context and then dispose of it. If I want to pass the Entity around, then there will be conflicts between Context and Entity. What is the suggested way of doing this ?

    Read the article

  • A WPF Image/Text Button

    - by psheriff
    Some of our customers are asking us to give them a Windows 8 look and feel for their applications. This includes things like buttons, tiles, application bars, and other features. In this blog post I will describe how to create a button that looks similar to those you will find in a Windows 8 application bar. In Figure 1 you can see two different kinds of buttons. In the top row is a WPF button where the content of the button includes a Border, an Image and a TextBlock. In the bottom row are four...(read more)

    Read the article

  • Should I start learning WPF?

    - by questron
    Hi, I've been studying C# for about 2 months so far, I have a few years experience programming however in VBA and VB6, but nothing too in depth (I've written simple tools, but nothing too advanced). I am very interested in WPF and I was wondering whether it would be too early for me to start learning how to use it? For reference, I am about 400 pages into 'Head First C#' and I've written a program that can quickly tag image files for moving into a predefined folder or to delete (Allows the user to pull images off of a camera memory card and sort VERY quickly). That's the most advanced app I've written.

    Read the article

  • Screenshot from WPF application as SVG / vector graphic?

    - by stefan.at.wpf
    Hello, is it possible to create a screenshot of a WPF application as SVG / is there some WPF built-in function to get the XAML code for the current drawn window that then can be converted to SVG? I need some screenshots for documenting a WPF application and I'd like them to be zoomable like a WPF program is using e.g. Snoop or Vista Magnifyer. Thanks for any hint!

    Read the article

  • In WPF, Selecting ItemContainerStyle based on data bound content

    - by Bart Roozendaal
    In #WPF you have ItemTemplateSelectors. But, can you also select an ItemContainerStyle based on the datatype of a bound object? I am databinding a scatterview. I want to set some properties of the generated ScatterViewItems based on the object in their DataContext. A mechanism similar to ItemTemplateSelector for styles would be great. Is that at all possible? I am now binding to properties in the objects that I am displaying to get the effect, but that feels like overhead and too complex (and most importantly, something that our XU designers can't do by themselves). This is the XAML that I am using now. Your help is greatly appreciated. <s:ScatterView x:Name="topicsViewer"> <s:ScatterView.ItemTemplateSelector> <local:TopicViewerDataTemplateSelector> <DataTemplate DataType="{x:Type mvc:S7VideoTopic}"> <Grid> <ContentPresenter Content="{Binding MediaElement}" /> <s:SurfaceButton Visibility="{Binding MailToVisible}" x:Name="mailto" Tag="{Binding Titel}" Click="mailto_Click" HorizontalAlignment="Right" VerticalAlignment="Top" Background="Transparent" Width="62" Height="36"> <Image Source="/Resources/MailTo.png" /> </s:SurfaceButton> <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center" Height="32"> <s:SurfaceButton Tag="{Binding MediaElement}" x:Name="btnPlay" Click="btnPlay_Click"> <Image Source="/Resources/control_play.png" /> </s:SurfaceButton> <s:SurfaceButton Tag="{Binding MediaElement}" x:Name="btnPause" Click="btnPause_Click"> <Image Source="/Resources/control_pause.png" /> </s:SurfaceButton> <s:SurfaceButton Tag="{Binding MediaElement}" x:Name="btnStop" Click="btnStop_Click"> <Image Source="/Resources/control_stop.png" /> </s:SurfaceButton> </StackPanel> </Grid> </DataTemplate> <DataTemplate DataType="{x:Type mvc:S7ImageTopic}"> <Grid> <ContentPresenter Content="{Binding Resource}" /> <s:SurfaceButton Visibility="{Binding MailToVisible}" x:Name="mailto" Tag="{Binding Titel}" Click="mailto_Click" HorizontalAlignment="Right" VerticalAlignment="Top" Background="Transparent" Width="62" Height="36"> <Image Source="/Resources/MailTo.png" /> </s:SurfaceButton> </Grid> </DataTemplate> <DataTemplate DataType="{x:Type local:Kassa}"> <ContentPresenter Content="{Binding}" Width="300" Height="355" /> </DataTemplate> </local:TopicViewerDataTemplateSelector> </s:ScatterView.ItemTemplateSelector> <s:ScatterView.ItemContainerStyle> <Style TargetType="s:ScatterViewItem"> <Setter Property="MinWidth" Value="200" /> <Setter Property="MinHeight" Value="150" /> <Setter Property="MaxWidth" Value="800" /> <Setter Property="MaxHeight" Value="700" /> <Setter Property="Width" Value="{Binding DefaultWidth}" /> <Setter Property="Height" Value="{Binding DefaultHeight}" /> <Setter Property="s:ScatterViewItem.CanMove" Value="{Binding CanMove}" /> <Setter Property="s:ScatterViewItem.CanScale" Value="{Binding CanScale}" /> <Setter Property="s:ScatterViewItem.CanRotate" Value="{Binding CanRotate}" /> <Setter Property="Background" Value="Transparent" /> </Style> </s:ScatterView.ItemContainerStyle> </s:ScatterView> Bart Roozendaal, Sevensteps

    Read the article

  • WPF: Sort of inconsistence in the visual appearence of WPF controls derived by Selector class

    - by msfanboy
    Hello, focused items == selected items but selected items != focused items. Have you ever wondered about that? Do you specially style the backcolor of a focused/selected item ? I ask this question because a user has an enabled button because some customer items are selected. The user is wondering now "why the heck can I delete this customers (button is enabled...) when I have just clicked on the orders control selecting some orders ready to delete (button is enabled too). The thing is the selected customer items are nearly looking grayed out in the default style... Well its sort of inconsistence to the user NOT to the programmer because WE know the behavior. Do you cope with stuff like that?

    Read the article

  • MVVM, ContextMenus and binding to ViewModel defined Command

    - by Simon Fox
    Hi I am having problems with the binding of a ContextMenu command to an ICommand property in my ViewModel. The binding seems to be attaching fine...i.e when I inspect the value of the ICommand property it is bound to an instance of RelayCommand. The CanExecute delegate does get invoked, however when I open the context menu and select an item the Execute delegate does not get invoked. Heres my View (which is defined as the DataTemplate to use for instances of the following ViewModel in a resource dictionary): <UserControl x:Class="SmartSystems.DragDropProto.ProductLinkView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Proto"> <UserControl.Resources> <local:CenteringConverter x:Key="centeringConvertor"> </local:CenteringConverter> </UserControl.Resources> <UserControl.ContextMenu> <ContextMenu> <MenuItem Command="{Binding ChangeColor}">Change Color</MenuItem> </ContextMenu> </UserControl.ContextMenu> <Canvas> <Ellipse Width="5" Height="5" > <Ellipse.Fill> <SolidColorBrush Color="{Binding LinkColor}"></SolidColorBrush> </Ellipse.Fill> <Ellipse.RenderTransform> <TranslateTransform X="{Binding EndpointOneXPos, Converter={StaticResource centeringConvertor}}" Y="{Binding EndpointOneYPos, Converter={StaticResource centeringConvertor}}"/> </Ellipse.RenderTransform> </Ellipse> <Line X1="{Binding Path=EndpointOneXPos}" Y1="{Binding Path=EndpointOneYPos}" X2="{Binding Path=EndpointTwoXPos}" Y2="{Binding Path=EndpointTwoYPos}"> <Line.Stroke> <SolidColorBrush Color="{Binding LinkColor}"></SolidColorBrush> </Line.Stroke> </Line> <Ellipse Width="5" Height="5" > <Ellipse.Fill> <SolidColorBrush Color="{Binding LinkColor}"></SolidColorBrush> </Ellipse.Fill> <Ellipse.RenderTransform> <TranslateTransform X="{Binding EndpointTwoXPos, Converter={StaticResource centeringConvertor}}" Y="{Binding EndpointTwoYPos, Converter={StaticResource centeringConvertor}}"/> </Ellipse.RenderTransform> </Ellipse> </Canvas> </UserControl> and ViewModel (with uneccessary implementation details removed): class ProductLinkViewModel : BaseViewModel { public ICommand ChangeColor { get; private set; } public Color LinkColor { get; private set; } public ProductLinkViewModel(....) { ... ChangeColor = new RelayCommand(ChangeColorAction); LinkColor = Colors.Blue; } private void ChangeColorAction(object param) { LinkColor = LinkColor == Colors.Blue ? Colors.Red : Colors.Blue; OnPropertyChanged("LinkColor"); } }

    Read the article

  • Windows Phone app: Binding data in a UserControl which is contained in a ListBox

    - by Alexandros Dafkos
    I have an "AddressListBox" ListBox that contains "AddressDetails" UserControl items, as shown in the .xaml file extract below. The Addresses collection is defined as ObservableCollection< Address Addresses and Street, Number, PostCode, City are properties of the Address class. The binding fails, when I use the "{Binding property}" syntax shown below. The binding succeeds, when I use the "dummy" strings in the commented-out code. I have also tried "{Binding Path=property}" syntax without success. Can you suggest what syntax I should use for binding the data in the user controls? <ListBox x:Name="AddressListBox" DataContext="{StaticResource dataSettings}" ItemsSource="{Binding Path=Addresses, Mode=TwoWay}"> <ListBox.ItemTemplate> <DataTemplate> <!-- <usercontrols:AddressDetails AddressRoad="dummy" AddressNumber="dummy2" AddressPostCode="dummy3" AddressCity="dummy4"> </usercontrols:AddressDetails> --> <usercontrols:AddressDetails AddressRoad="{Binding Street}" AddressNumber="{Binding Number}" AddressPostCode="{Binding PostCode}" AddressCity="{Binding City}"> </usercontrols:AddressDetails> </DataTemplate> </ListBox.ItemTemplate> </ListBox>

    Read the article

  • Making a C# w/ WPF multiple frame text / pseudo-calendar GUI application [closed]

    - by Gregor Samsa
    I am editing a recently asked question and making it specific, taking the advice of some people here. I would like to program of the following simple form: The user can produce X number of resizable frames (analogous to HTML frames). Each frame serves as a simple text editor, which you can type into and save the whole configuration including resized windows and text. The user should be able alternately "freeze" and present the information, and "unfreeze" and edit frames. I want to use C## with WPF, in Microsoft's Visual C#. I do not yet know this language. I am sure I can pick up the syntax, but I would like to ask about some general advice for how to structure such a program. I have never made a GUI program, let alone one that interfaces with a notepad or some basic text editor. Can someone either direct me to a good resource that will teach me how to do the above? Or outline the basic ingredients that such a program will require, keeping in mind that though I know some C and Python, I have no experience with GUIs or advanced programming generally? In particular I don't know how to incorporate this "text editor" aspect of the program, as well as the resizable frames I would greatly appreciate any help.

    Read the article

  • WPF - List View Row Index and Validation

    - by abhishek
    Hi, I have a ListView with TextBoxes in second column. I want to validate that my text box does not contain a number if the third column(data_type) is "Text". I am unable to do the validation. I tried a few approaches. In one approach I try to handle the MouseDown event and am trying to get the Row number so that I can get the data_type value of that row. I want to us this value in the Validate method. I have been struggling for a week now. Would appreciate if anybody could help. <ControlTemplate x:Key="validationTemplate"> <DockPanel> <TextBlock Foreground="Red" FontSize="20">!</TextBlock> <AdornedElementPlaceholder/> </DockPanel> </ControlTemplate> <Style x:Key="textBoxInError" TargetType="{x:Type TextBox}"> <Style.Triggers> <Trigger Property="Validation.HasError" Value="true"> <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </Trigger> </Style.Triggers> </Style> <DataTemplate x:Key="textTemplate"> <TextBox HorizontalAlignment= "Stretch" IsEnabled="{Binding XPath=./@isenabled}" Validation.ErrorTemplate="{StaticResource validationTemplate}" Style="{StaticResource textBoxInError}"> <TextBox.Text> <Binding XPath="./@value" UpdateSourceTrigger="PropertyChanged"> <Binding.ValidationRules> <local:TextBoxMinMaxValidation> <local:TextBoxMinMaxValidation.DataType> <local:DataTypeCheck Datatype="{Binding Source={StaticResource dataProvider}, XPath='/[@id=CustomerServiceQueueName]'}"/> </local:TextBoxMinMaxValidation.DataType> <local:TextBoxMinMaxValidation.ValidRange> <local:Int32RangeChecker Minimum="{Binding Source={StaticResource dataProvider}, XPath=./@min}" Maximum="{Binding Source={StaticResource dataProvider}, XPath=./@max}"/> </local:TextBoxMinMaxValidation.ValidRange> </local:TextBoxMinMaxValidation> </Binding.ValidationRules> </Binding > </TextBox.Text> </TextBox> </DataTemplate> <DataTemplate x:Key="dropDownTemplate"> <ComboBox Name="cmbBox" HorizontalAlignment="Stretch" SelectedIndex="{Binding XPath=./@value}" ItemsSource="{Binding XPath=.//OPTION/@value}" IsEnabled="{Binding XPath=./@isenabled}" /> </DataTemplate> <DataTemplate x:Key="booldropDownTemplate"> <ComboBox Name="cmbBox" HorizontalAlignment="Stretch" SelectedIndex="{Binding XPath=./@value, Converter={StaticResource boolconvert}}"> <ComboBoxItem>True</ComboBoxItem> <ComboBoxItem>False</ComboBoxItem> </ComboBox> </DataTemplate> <local:ControlTemplateSelector x:Key="myControlTemplateSelector"/> <Style x:Key="StretchedContainerStyle" TargetType="{x:Type ListViewItem}"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="Template" Value="{DynamicResource ListBoxItemControlTemplate1}"/> </Style> <ControlTemplate x:Key="ListBoxItemControlTemplate1" TargetType="{x:Type ListBoxItem}"> <Border SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" Padding="{TemplateBinding Padding}" BorderThickness="0,0.5,0,0.5"> <GridViewRowPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </Border> </ControlTemplate> <Style x:Key="CustomHeaderStyle" TargetType="{x:Type GridViewColumnHeader}"> <Setter Property="Background" Value="LightGray" /> <Setter Property="FontWeight" Value="Bold"/> <Setter Property="FontFamily" Value="Arial"/> <Setter Property="HorizontalContentAlignment" Value="Left" /> <Setter Property="Padding" Value="2,0,2,0"/> </Style> </UserControl.Resources> <Grid x:Name="GridViewControl" Height="Auto"> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="34"/> </Grid.RowDefinitions> <ListView x:Name="ListViewControl" Grid.Row="0" ItemContainerStyle="{DynamicResource StretchedContainerStyle}" ItemTemplateSelector="{DynamicResource myControlTemplateSelector}" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding Source={StaticResource dataProvider}, XPath=//CONFIGURATION}"> <ListView.View > <GridView > <GridViewColumn Header="ID" HeaderContainerStyle="{StaticResource CustomHeaderStyle}" DisplayMemberBinding="{Binding XPath=./@id}"/> <GridViewColumn Header="VALUE" HeaderContainerStyle="{StaticResource CustomHeaderStyle}" CellTemplateSelector="{DynamicResource myControlTemplateSelector}" /> <GridViewColumn Header="DATATYPE" HeaderContainerStyle="{StaticResource CustomHeaderStyle}" DisplayMemberBinding="{Binding XPath=./@data_type}"/> <GridViewColumn Header="DESCRIPTION" HeaderContainerStyle="{StaticResource CustomHeaderStyle}" DisplayMemberBinding="{Binding XPath=./@description}" Width="{Binding ElementName=ListViewControl, Path=ActualWidth}"/> </GridView> </ListView.View> </ListView> <StackPanel Grid.Row="1"> <Button Grid.Row="1" HorizontalAlignment="Stretch" Height="34" HorizontalContentAlignment="Stretch" > <StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Center" Orientation="Horizontal" FlowDirection="RightToLeft" Height="30"> <Button Grid.Row="1" Content ="Apply" Padding="0,0,0,0 " Margin="6,2,0,2" Name="btn_Apply" HorizontalAlignment="Right" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Width="132" IsTabStop="True" Click="btn_ApplyClick" Height="24" /> </StackPanel > </Button> </StackPanel > </Grid>

    Read the article

  • an enter key are handled twice in WPF/Winform mixed project

    - by user527403
    I have a winform dashboard which hosts some WPF dialogs. When I select a row in the winform ListView and hit Enter key, OnItemActivate is called which launches a WPF dialog. However, the WPF dialog appears and then disappears immediately because the default button “cancel” is hit. It seems that the Enter key is triggered twice, one for launching the WPF dialog, the other for hitting cancel button. We don’t want the WPF dialog to be canceled by the Enter key hitting. According to the stack trace, it looks like that WPF and Winform handle the enter key separately. The WPF does not know that the enter key has been handled by the Winform ListView. Is this by design in Winform and WPF interop? To make the enter key not close the WPF dialog, we have to change the focus from the cancel button to another control (e.g. a textblock). Is there a better way to fix/around this issue?

    Read the article

  • WPF TextBlock refresh in real time

    - by TheOnlyBrien
    I'm new to C#, in fact, this is one of the first projects I've tried to start on my own. I am curious why the TextBlock will not refresh with the following code? The WPF window does not even show up when I add the "while" loop to the code. I just want this to have a real time display of the days since I was born. Please help me out or give me constructive direction. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace daysAliveWPF { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); DateTime myBirthday = new DateTime(1984, 01, 19); while (true) { TimeSpan daysAlive = DateTime.Now.Subtract(myBirthday); MyTextBlock.Text = daysAlive.TotalDays.ToString(); } } } } Similar code has worked in a Console Window application, so I don't understand what's going on here. Console Application code snip that did work is: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace DisplayRealTime { class Program { static void Main(string[] args) { DateTime myBirthday = new DateTime(1984, 06, 19); while (true) { TimeSpan daysAlive = DateTime.Now.Subtract(myBirthday); Console.Write("\rTotal Days Alive: {0}", daysAlive.TotalDays.ToString(".#####")); } } } } Thank you!

    Read the article

  • What is a good alternative to the WPF WebBrowser Control?

    - by VoidDweller
    I have an MDI WPF app that I need to add web content to. At first, great it looks like I have 2 options built into the framework the Frame control and the WebBrowser control. Given that this is an MDI app it doesn't take long to discover that neither of these will work. The WPF WebBrowser control wraps up the IE WebBrowser ActiveX Control which uses the Win32 graphics pipeline. The "Airspace" issue pretty much sums this up as "Sorry, the layouts will not play nice together". Yes, I have thought about taking snapshots of the web content rendering these and mapping the mouse and keyboard events back to the browser control, but I can't afford the performance penalty and I really don't have time to write and thoroughly test it. I have looked for third party controls, but so far I have only found Chris Cavanagh's WPF Chromium Web Browser control. Which wraps up Awesomium 1.5. Together these are very cool, they play nice with the WPF layouts. But they do not meet my performance requirements. They are VERY HEAVY on memory consumption and not to friendly with CPU usage either. Not to mention still quite buggy. I'll elaborate if you are interested. So, do any of you know of a stable performant WPF web browser control? Thanks.

    Read the article

  • How do I pass arguments to pages in a WPF application?

    - by Rod
    I'm working on upgrading a really old VB6 app to a WPF application. This will be a page-based app, but not a XBAP. The old VB6 app had a start form where a user would enter search criteria. Then they would get results in a grid, select a row in the grid and then click on one of 3 buttons. I am thinking that what I'll do is use hyperlink controls on the WPF app. No matter what button the user clicked on the old VB6 app, it would go to a second form. What it did on the second form was dependent upon which button the user clicked on the first form. So, I want the first page in my WPF app to do the same thing, but depending upon which hyperlink they click on will dictate what happens on the second page. They will either (a) go to the second page to edit the details as well as a lot more information, related to what they selected on the first page, or (b) enter a new record and all associated data (a new client, in this case), or (c) create a new case for the same client, selected on the first page. For me the hard thing is I don't know how to pass that information along to the second page. Is there something in WPF like in HTML where there's a query string? Or how do you get information from the first page to the second page, in WPF? I'm working in VS 2008.

    Read the article

  • WPF/XAML - compare the "SelectedIndex" of two comboboxes (DataTrigger?)

    - by Luaca
    hello, i've got two comboboxes with the same content. the user should not be allowed to choose the same item twice. therefore the comboboxes' contents (= selectedindex?) should never be equal. my first attempt was to comapare the selectedindex with a datatrigger to show/hide a button: <DataTrigger Binding="{Binding ElementName=comboBox1, Path=SelectedIndex}" Value="{Binding ElementName=comboBox2, Path=SelectedIndex}"> <Setter Property="Visibility" Value="Hidden" /> </DataTrigger> it seems that it is not possible to use Value={Binding}. is there any other way (if possible without using a converter)? thanks in advance!

    Read the article

  • treeview binding wpf cannot bind nested property in a class

    - by devnet247
    Hi all New to wpf and therefore struggling a bit. I am putting together a quick demo before we go for the full implementation I have a treeview on the left with Continent Country City structure when a user select the city it should populate some textboxes in a tabcontrol on the right hand side I made it sort of work but cannot make it work with composite objects. In a nutshell can you spot what is wrong with my zaml or code. Why is not binding to a my CityDetails.ClubsCount or CityDetails.PubsCount? What I am building is based on http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx Thanks a lot for any suggestions or reply DataModel public class City { public City(string cityName) { CityName = cityName; } public string CityName { get; set; } public string Population { get; set; } public string Area { get; set; } public CityDetails CityDetailsInfo { get; set; } } public class CityDetails { public CityDetails(int pubsCount,int clubsCount) { PubsCount = pubsCount; ClubsCount = clubsCount; } public int ClubsCount { get; set; } public int PubsCount { get; set; } } ViewModel public class CityViewModel : TreeViewItemViewModel { private City _city; private RelayCommand _testCommand; public CityViewModel(City city, CountryViewModel countryViewModel):base(countryViewModel,false) { _city = city; } public string CityName { get { return _city.CityName; } } public string Area { get { return _city.Area; } } public string Population { get { return _city.Population; } } public City City { get { return _city; } set { _city = value; } } public CityDetails CityDetailsInfo { get { return _city.CityDetailsInfo; } set { _city.CityDetailsInfo = value; } } } XAML <DockPanel> <DockPanel LastChildFill="True"> <Label DockPanel.Dock="top" Content="Title " HorizontalAlignment="Center"></Label> <StatusBar DockPanel.Dock="Bottom"> <StatusBarItem Content="Status Bar" ></StatusBarItem> </StatusBar> <Grid DockPanel.Dock="Top"> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="2*"/> </Grid.ColumnDefinitions> <TreeView Name="tree" ItemsSource="{Binding Continents}"> <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="{Binding IsExpanded,Mode=TwoWay}"/> <Setter Property="IsSelected" Value="{Binding IsSelected,Mode=TwoWay}"/> <Setter Property="FontWeight" Value="Normal"/> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="FontWeight" Value="Bold"></Setter> </Trigger> </Style.Triggers> </Style> </TreeView.ItemContainerStyle> <TreeView.Resources> <HierarchicalDataTemplate DataType="{x:Type ViewModels:ContinentViewModel}" ItemsSource="{Binding Children}"> <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\Continent.png"/> <TextBlock Text="{Binding ContinentName}"/> </StackPanel> </HierarchicalDataTemplate> <HierarchicalDataTemplate DataType="{x:Type ViewModels:CountryViewModel}" ItemsSource="{Binding Children}"> <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\Country.png"/> <TextBlock Text="{Binding CountryName}"/> </StackPanel> </HierarchicalDataTemplate> <DataTemplate DataType="{x:Type ViewModels:CityViewModel}" > <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0" Source="Images\City.png"/> <TextBlock Text="{Binding CityName}"/> </StackPanel> </DataTemplate> </TreeView.Resources> </TreeView> <GridSplitter Grid.Row="0" Grid.Column="1" Background="LightGray" Width="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> <Grid Grid.Column="2" Margin="5" > <TabControl> <TabItem Header="Details" DataContext="{Binding Path=SelectedItem.City, ElementName=tree, Mode=OneWay}"> <StackPanel > <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding CityName}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding Area}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding Population}"/> <!-- DONT WORK WHY--> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding SelectedItem.CityDetailsInfo.ClubsCount}"/> <TextBlock VerticalAlignment="Center" FontSize="12" Text="{Binding SelectedItem.CityDetailsInfo.PubsCount}"/> </StackPanel> </TabItem> </TabControl> </Grid> </Grid> </DockPanel> </DockPanel>

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >