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
  • Json Based Themes

    android ios json help question
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • DropDown TreeView

    wpf wcf help question
    4
    0 Votes
    4 Posts
    13 Views
    L
    I've implemented "tree views" using a user control "around" a ListView. All my user control revolve around something; nothing ever so special that it required a "custom control" (which is more complicated). For a tree view - list view, each item is a usercontrol that can "indent" or "hide" itself (when expanding or collapsing). The item's user control has it's own data template; and that's how you can have every every item (level) look different by selectively exposing different parts of the same UC type. All that's required of the item "data container" is a level number and an "expanded / collapsed" indicator; the level number is used to compute the indent (a Margin or some other "empty" object with length). The items are of course loaded in the proper sequence (hierarchy / BOM). A selection change handler can identify what level and "node" is being accessed. An expand / collapsed method keys off the current selected item and just travels the sequence below that depth. I also added parent and child pointers (based on my needs). And added drag and drop from the (listview) tree view. On the surface, you can't tell it's a listview. Once you build one, only the item data template changes for the next "tree view". The "drop down" could be the tree view inside a ScrollViewer, inside an Expander. Or a popup. What ever works best. "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
  • 0 Votes
    8 Posts
    25 Views
    S
    @Graeme_Grand [^] ///// Yes, I have a 100% working solution right now and I'll post it as soon as I get back the reputation points that were taken away from me for daring to be right!!! PS: Some people in here need a psychiatric follow-up. Frankly...
  • WPF .Net Core 6 RelayCommand Problem

    csharp wpf asp-net dotnet design
    2
    0 Votes
    2 Posts
    7 Views
    Richard DeemingR
    Looking at the source code for CommunityToolkit.Mvvm.Input.RelayCommand[^], it doesn't use the CommandManager at all. You need to explicitly call the NotifyCanExecuteChanged method[^] instead. NB: That SetProperty method looks odd - any relatively recent framework would use [CallerMemberName] so that you don't need to pass the name of the property: protected bool SetProperty(ref T storage, T value, [CallerMemberName] string propertyName = null) { if (Equals(storage, value)) return false; storage = value; OnPropertyChanged(propertyName); return true; } public string? UserName { get { return _UserName; } set { SetProperty(ref _UserName, value); } } "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • how to set the icon for output result(.exe) in vs2022 ?

    tutorial question
    3
    0 Votes
    3 Posts
    11 Views
    U
    Got it, thanks a lot.
  • Expander Width Problem

    wpf css wcf help question
    2
    0 Votes
    2 Posts
    6 Views
    L
    You should know what the maximum header width will be; set the .Width accordingly. (The framework doesn't know beforehand). "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
  • TabItem Render

    help question
    5
    0 Votes
    5 Posts
    15 Views
    L
    TabItem inherits from FrameworkElement and therefore has a "Loaded" event. "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
  • WPF Custom Control & User Control

    csharp wpf design help tutorial
    10
    0 Votes
    10 Posts
    27 Views
    K
    Sorry for the confusion. I just asumed that MVVM is the way most folks do things. So I found out a way to load my control: public override void OnApplyTemplate() { base.OnApplyTemplate(); Load(); } Not sure if this is the best way, but it works. Thanks If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
  • WPF .Net Core Dependency Injection & View Models

    csharp dotnet asp-net wpf testing
    2
    0 Votes
    2 Posts
    8 Views
    Graeme_GrantG
    Watch this: Models - WPF MVVM TUTORIAL #1 - YouTube[^] - he will answer many questions for you, including this one! Graeme "I fear not the man who has practiced ten thousand kicks one time, but I fear the man that has practiced one kick ten thousand times!" - Bruce Lee
  • Path Image

    question csharp wpf com help
    4
    0 Votes
    4 Posts
    13 Views
    L
    No, I'm not seeing that. You're either inheriting something; or it's a version thing. I tested it with a new WPF .NET 6.0 project. "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
  • Image Path Data

    question wpf help
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • 0 Votes
    4 Posts
    17 Views
    D
    That explains it. You have MUCH greater control just by typing the XAML directly. Nobody uses the Properties window to do this, or anything else for that matter. For example: ImageSource="Images\\Tile.bmp" Viewport="0,0,.2,.4" ViewportUnits="RelativeToBoundingBox" /> Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles. Dave Kreskowiak
  • 0 Votes
    1 Posts
    4 Views
    No one has replied
  • 0 Votes
    3 Posts
    10 Views
    M
    Yeah, I'm using INotifyPropertyChanged and ObservableCollection (did not want to clutter the example) Ohhhh !!! thanks. :rose::rose: Fixed. I read that (passing the modelview to components) on a tutorial: See: [youtube-viewers/MainWindow.xaml at master · SingletonSean/youtube-viewers · GitHub](https://github.com/SingletonSean/youtube-viewers/blob/master/YouTubeViewers.WPF/MainWindow.xaml) And at the end of : [youtube-viewers/YouTubeViewersView.xaml at master · SingletonSean/youtube-viewers · GitHub](https://github.com/SingletonSean/youtube-viewers/blob/master/YouTubeViewers.WPF/Views/YouTubeViewersView.xaml) CI/CD = Continuous Impediment/Continuous Despair
  • fast directory infos for a lot of files

    csharp database sqlite wpf help
    5
    0 Votes
    5 Posts
    17 Views
    P
    Thanks Richard, thats really great. A little correction to the following line: using (SQLiteCommand dbCom = new SQLiteCommand("INSERT INTO Dateien (Pfad, Datei) VALUES ($Pfad, $Datei)")) to using (SQLiteCommand dbCom = new SQLiteCommand("INSERT INTO Dateien (Pfad, Datei) VALUES ($Pfad, $Datei)", dbConn, dbTrans)) And now it works perfectly. And wow, it's done in 12 seconds !!! Very impressive !!! THANKS!
  • Custom Control Styling

    wpf csharp asp-net database dotnet
    6
    0 Votes
    6 Posts
    21 Views
    Richard DeemingR
    The AddOwner syntax lets you register another type for use with a DependencyProperty which has already been registered: How to: Add an Owner Type for a Dependency Property - WPF .NET Framework | Microsoft Learn[^] DependencyProperty.AddOwner Method (System.Windows) | Microsoft Learn[^] You can't use the TextDecorations class[^] as the property type; that's a static class used to provide access to the standard text decorations. Instead, you need to use the TextDecorationCollection class[^] as the property type, which is what the Inlines.TextDecorations property[^] does: Reference Source[^]: /// /// DependencyProperty for
  • Forgot Password

    question csharp wpf help
    2
    0 Votes
    2 Posts
    8 Views
    Richard DeemingR
    Troy Hunt: Everything you ever wanted to know about building a secure password reset feature[^] "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • WPF .Net Core Relay Command with Parameters

    csharp wpf asp-net dotnet wcf
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • DropShadowEffect Above & Below

    question help
    4
    0 Votes
    4 Posts
    14 Views
    Richard DeemingR
    Try setting the ShadowDepth to 0 and playing with the BlurRadius instead. "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • WPF Core Hyperlkink Custom Control

    wpf csharp dotnet asp-net wcf
    5
    0 Votes
    5 Posts
    13 Views
    Richard DeemingR
    {TemplateBinding x} should be equivalent to {Binding x, RelativeSource={RelativeSource TemplatedParent}}. The error is telling you that you can't set a RelativeSource on a TemplateBinding. "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer