Skip to content

WPF

Silverlight, WPF and XAML programming discussions

This category can be followed from the open social web via the handle wpf@forum.codeproject.com

4.8k Topics 18.9k Posts
  • Looking for key handling tip

    csharp dotnet wpf com json
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • Setting DataGrid Cell Style From Code Behind

    css wpf wcf question career
    2
    0 Votes
    2 Posts
    4 Views
    realJSOPR
    If the way you're doing it works without side-effects, that's the right way to do it. :) ".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
  • Input Question

    question csharp css com docker
    5
    0 Votes
    5 Posts
    3 Views
    S
    BTW the inline text editor is progressing nicely.. now I "just" need to add the text to the map... :) [Text-Input — ImgBB](https://ibb.co/0qkJbwL) A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
  • (Advanced?) Layout question

    question csharp com graphics docker
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • About RichTextBox size in a canvas

    csharp tutorial wpf com graphics
    22
    0 Votes
    22 Posts
    34 Views
    S
    Yeah, well, mmm.. isn't what I just said? Anyway, this is exactly what I am doing! :thumbsup: :) And, in other news, I got the text editor just appearing on my map, finally! :) A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
  • WPF Converter Set or Library

    csharp database wpf com question
    17
    0 Votes
    17 Posts
    35 Views
    S
    forget it... converter are the simplest thing to write. if you feel the need to download premade one, you need more practice writing ones! ;P also, most of them, apart perhaps from the classical boolean to visibility, null to boolean, and null to visibility and color to brushes and pens, are specific to your application A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
  • ListBox selection through code, in MVVM

    wpf architecture question
    9
    0 Votes
    9 Posts
    8 Views
    realJSOPR
    I use ListViews. In fact. I wrote an article on CodeProject that illustrates a custom ListView control that can auto-generate columns based on the dataset being represented. It doesn't support editable cells, but it does have sort functionality (that can be toggled on a column-by-column basis, column name overrides, custom column formatting, and other stuff. Auto-generated columns in a WPF ListView[^] ".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
  • Using custom fonts in WPF project

    wpf help csharp com learning
    7
    0 Votes
    7 Posts
    5 Views
    D
    DS-Digital works fine in WPF. I'm using it in a tool I wrote last year. I added the font .ttf files to a Fonts folder in my project. Set them to "Resource", NOT "Embedded Resource". In my XAML, I've got the following: ./Fonts/#DS-Digital ... ...and wherever I want to use the font: Of course, you can always use the same font path in a Style block with a FontFamily. Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak
  • Quick MVVM Design Question

    wpf design architecture help question
    6
    0 Votes
    6 Posts
    7 Views
    realJSOPR
    When I instantiate a VM, it typically instantiates the model on its own, which retrieves the data (from a database, xml, or json file). If the requirements call for modifying/saving the data, I keep the model around in a protected property inside the viewmodel. Most of the time, I set the data context to the form, and bind controls to the viewmodel(s) and various other properties. I don't think I've ever set the data context to a specific viewmodel because that just means more typing. ".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
  • WPF MVVM Modeless Dialogs - any Example?

    csharp wpf tutorial question visual-studio
    4
    0 Votes
    4 Posts
    2 Views
    realJSOPR
    I wrote an article: WPF - Modeless Window Manager[^] This code will manage the modeless window for you, and provides several handy features. In my own code, I instantiate all windows from the UI, but if it's more handy for your app to instantiate a view from the viewmodel itself, go forth and break tradition. Remember, all of the "rules" you read are actually just guidelines. Yes, you should strive to follow industry best-practice, but you should also be flexible enough to know when you can step outside the box. ".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
  • 0 Votes
    4 Posts
    5 Views
    L
    You're welcome! It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
  • VB.net - WPF - Help with treeview

    csharp wpf help winforms
    4
    0 Votes
    4 Posts
    2 Views
    Richard DeemingR
    Your WPF code is using a ListBox, not a tree-view control. TreeView, data binding and multiple templates - The complete WPF tutorial[^] TreeView Overview - WPF .NET Framework | Microsoft Docs[^] How to: Create Simple or Complex TreeViews - WPF .NET Framework | Microsoft Docs[^] "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • DataGridCell Style Problem

    help wpf question csharp wcf
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • 0 Votes
    10 Posts
    3 Views
    L
    Right. Now you can start thinking about axis labels, legends, titles, data sources, etc. It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
  • 0 Votes
    10 Posts
    4 Views
    M
    I have also seen static's used. Not a "static" fan but it works. Static's have there place. The reason Serilog is so easy to use and hence popular is because of static's. So many years of programming I have forgotten more languages than I know.
  • (xaml, wpf) ScrollViewer Binding confusion (beginner)

    wpf csharp wcf design devops
    3
    0 Votes
    3 Posts
    4 Views
    L
    I don't understand your apprehension about the "direct" approach ... or is this another "MVVM" thing? private void Containers_OnTargetUpdated(object? Sender, DataTransferEventArgs E) { this.Scroller.ScrollToHome(); } The compiler recognize the name you gave to the ScrollViewer in the XAML (for that page / control); you don't need "reflection" in this case. For other "public" cases, add a public "getter" for the control in question. I assume you have some idea when the ItemsSource to the list is changed; set the scroll then if event handling is too confusing. It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food
  • Currency Entry Issue

    help wpf design question
    3
    0 Votes
    3 Posts
    3 Views
    K
    How did you remember that?? I totally forgot I posted that. If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
  • Page/Frame

    question learning
    3
    0 Votes
    3 Posts
    4 Views
    M
    I like that phrase, "ferret it out". It is a common idiom. I brings to mind the furry little animal that seems to not have a spine and can get into all kinds of places. Per Wikipedia, The name "ferret" is derived from the Latin furittus, meaning "little thief". In this case wiggling around a lot and stealing results from obscure references. So many years of programming I have forgotten more languages than I know.
  • Stuck with Weird Exceptions

    hardware help question
    3
    0 Votes
    3 Posts
    4 Views
    K
    Thanks, but I already checked into that. No luck. So this morning, on a hunch, I replaced my clone method with this public static T Clone<T>(this T source) where T : class { var clonedJson = JsonConvert.SerializeObject(source); return JsonConvert.DeserializeObject<T>(clonedJson); } and it now works. The previous clone code I posted was working up until something changed this week when it stopped working. Strange. Thanks for your help. If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
  • Disable ComboBox Hyperlinks

    help css wpf tutorial question
    4
    0 Votes
    4 Posts
    6 Views
    M
    Use a DataTemplateSelector as the ComboBox.ItemTemplateSelector. The SelectTemplate() method will be passed each item, (the enum in your case). Select a data template specific to each case you want. "Fairy tales do not tell children the dragons exist. Children already know that dragons exist. Fairy tales tell children the dragons can be killed." - G.K. Chesterton