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
  • List of Images

    com docker help question
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • Change Image URL's Assembly At Runtime

    wpf csharp question announcement
    2
    0 Votes
    2 Posts
    8 Views
    L
    Use relative Pack URI's. [Pack URIs - WPF .NET Framework | Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/desktop/wpf/app-development/pack-uris-in-wpf?view=netframeworkdesktop-4.8) "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
  • c# Spotify API not returning correctly.

    json csharp com announcement
    3
    0 Votes
    3 Posts
    10 Views
    J
    elfenliedtopfan5 wrote: what i am doing wrong Perhaps something is eating an exception? Not clear how you determined that the response content is valid json. You can also experiment (test) by populating everything in your json objects. Then serialize them to a string. Output that (so you have an example) then deserialize the same thing.
  • 0 Votes
    3 Posts
    10 Views
    Richard DeemingR
    As Jeron said, the forum at the bottom of the article[^] is the place to post questions about the article. However, the author hasn't been active since 2014, so it's possible he may not still be here. "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • Bubbling Event Question

    wpf question csharp dotnet wcf
    13
    0 Votes
    13 Posts
    41 Views
    K
    Referring to the first pic with all the nested controls, I have this Routed even deep inside MyNewControl public static readonly RoutedEvent ItemSelectedEvent = EventManager.RegisterRoutedEvent("ItemSelected", RoutingStrategy.Tunnel, typeof(RoutedEventHandler), typeof(NavigationPane)); public event RoutedEventHandler ItemSelected { add { AddHandler(ItemSelectedEvent, value); } remove { RemoveHandler(ItemSelectedEvent, value); } } private void RaiseItemSelectedEvent() { // Raise the event, passing the selected item vars args = new SelectedItemEventArgs(ItemSelectedEvent, SelectedItem); RaiseEvent(args); } How do I catch this event in the window? What is the syntax? Using some kind of Preview_... is going to catch a LOT of events. Is there no way to subscribe directly to that event from the Window? If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
  • NavigationControl - Part 3

    com collaboration help question
    3
    0 Votes
    3 Posts
    11 Views
    K
    Thanks, I understand the change you recommened, but it doesn't seem to change anything. I have two different issues. I beleive I solved the first one. 1. The Projects pane should be expanded on startup BEFORE it loads so the user seees the wait indicator. This bit of code in the MainWindow simulates storing and resetting it from settings later on. if there was an ExpandedExpanded (past-tense) then I could call Load() from there. Main Window.cs NavigationPaneInfos = new List { new NavigationPaneModel { Header = "Projects", NavigationItemType = NavigationItemType.Project, DataSource = Functional.Apply(Repository.GetNavigationItems, NavigationItemType.Project), IsExpanded = true // <====== 1. This should force the Projects pane to expand on startup, and that should trigger Load() after the wait indicator is visible }, new NavigationPaneModel { Header = "Inventory", NavigationItemType = NavigationItemType.Inventory, DataSource = Functional.Apply(Repository.GetNavigationItems, NavigationItemType.Inventory), }, new NavigationPaneModel { Header = "Companies" , NavigationItemType = NavigationItemType.Company, DataSource = Functional.Apply(Repository.GetNavigationItems, NavigationItemType.Company), }, new NavigationPaneModel { Header = "Employees", NavigationItemType = NavigationItemType.Employee, DataSource = Functional.Apply(Repository.GetNavigationItems, NavigationItemType.Employee), } }; so, that caused this private static object CoerceIsPaneExpanded(DependencyObject d, object baseValue) { var control = (NavigationPane)d; var newVal = control._isInitialized ? baseValue : (object)false; return newVal; //<======= THIS IS NEVER TRUE } and private void NavigationPane\_Initialized(object? sender, EventArgs e) { \_isInitialized = true; CoerceValue(IsPaneExpandedProperty); if (\_isPaneExpanded) //<====== 2. THIS IS NEVER TRUE { \_ = Load(); } } so, I added this, which correctly sets _isPaneExpanded based off the value set in the main window private static async void OnNavigationPaneModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = (NavigationPane)d; var model = e.NewValue as N
  • Expander Header Content Stretch

    wpf help css wcf question
    3
    0 Votes
    3 Posts
    9 Views
    K
    That did it. I saw this article already and tried the XAML approach. I should have hep reading. Thanks If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
  • 0 Votes
    3 Posts
    8 Views
    Richard DeemingR
    GitHub - punker76/gong-wpf-dragdrop: The GongSolutions.WPF.DragDrop library is a drag'n'drop framework for WPF[^] "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • ListBoxItem DataTemplate with HyperLink Problem

    wpf question wcf help
    3
    0 Votes
    3 Posts
    9 Views
    K
    That did it. Thanks If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
  • ListBox With Hyperlinks - Pass Bound Item

    help wpf wcf question
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • CustomControl Styling Question

    question dotnet wpf com
    2
    0 Votes
    2 Posts
    8 Views
    P
    Well, the easiest way to let people know is if you document the styles just the way you have here. If people want to adjust the triggers and templates, they can see what is affected just by reading the documentation. Advanced TypeScript Programming Projects
  • NavigationControl - Continued

    com docker collaboration question
    5
    0 Votes
    5 Posts
    14 Views
    Richard DeemingR
    The problem is you have two instances of the NavigationPane for each expander - one that you create through code and add to the ContainerItems property, and one that's declared in XAML. You don't have a binding for the NavigationPaneModel property in the XAML, so that property doesn't propagate from the ContainerItems instance to the XAML instance. If you add a binding, then the property won't be null: Alternatively, remove the ListBox.ItemTemplate so that the list displays the items created in code. You can use a style to set the additional properties: <Setter Property="BorderBrush" Value="Orange" /> <Setter Property="BorderThickness" Value="3" /> <Setter Property="Background" Value="Red" /> <Setter Property="Margin" Value="0,0,0,1" /> "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • WPF 3D rendering

    help question csharp database wpf
    5
    0 Votes
    5 Posts
    15 Views
    K
    Nah, I came across an article that solved everything for me: Introduction to glTF for WPF 3D[^]
  • Expander in ListBoxItem Width Problem

    help php wpf wcf com
    3
    0 Votes
    3 Posts
    8 Views
    K
    That did it. I spent hours trying to figure that out. It seems in this case all the properties have to be just right. Thanks If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
  • Spinning Indicator Control Error

    help question
    7
    0 Votes
    7 Posts
    20 Views
    K
    My message dissappeared :confused::confused::confused: Anyhow, I have been slowly developing my own custom control library and I was hoping to port this to it. I guess I'll leave it in a UserControl. I knew about the Community Toolkit, and also, here's a cool implementation with very little code[^] Thanks If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
  • Custom Navigation Control

    wpf csharp asp-net wcf docker
    12
    0 Votes
    12 Posts
    38 Views
    K
    Richard, after implementing your changes, the loading works fine, but I now have this problem[^] with the expander headers. I would appreciate your input. If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
  • Flat Button Style Problem

    database help
    6
    0 Votes
    6 Posts
    21 Views
    L
    If content is a "string" (as in your case), the Button uses a TextBlock; if content is some UI element composite, a "ForeGround" color may make little sense. So, yes, I would have used a TextBlock (as "content") in the first place. (I sometimes use one or more FontIcons overlayed in a grid). (The "dynamic" resource binding also makes little sense in this case) "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
  • Path in Style Question

    question database help
    6
    0 Votes
    6 Posts
    17 Views
    K
    FYI, here's what I came up with. Thanks for your help! Control public class MaroisPathImageButton : Button { #region CTOR static MaroisPathImageButton() { DefaultStyleKeyProperty.OverrideMetadata(typeof(MaroisPathImageButton), new FrameworkPropertyMetadata(typeof(MaroisPathImageButton))); } #endregion #region Dependency Properties #region DP Caption public static readonly DependencyProperty CaptionProperty = DependencyProperty.Register("Caption", typeof(string), typeof(MaroisPathImageButton), new PropertyMetadata("")); public string Caption { get { return (string)GetValue(CaptionProperty); } set { SetValue(CaptionProperty, value); } } #endregion #region DP PathData public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register("PathData", typeof(System.Windows.Media.Geometry), typeof(MaroisPathImageButton), new PropertyMetadata(null, new PropertyChangedCallback(OnPathDataChanged))); public System.Windows.Media.Geometry PathData { get { return (System.Windows.Media.Geometry)GetValue(PathDataProperty); } set { SetValue(PathDataProperty, value); } } private static void OnPathDataChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { MaroisPathImageButton control = (MaroisPathImageButton)d; } #endregion #endregion } Theme <!--PATH DATA--> <Geometry x:Key="toolbarHomeButtonPathData"> M12 5.69L17 10.19V18H15V12H9V18H7V10.19L12 5.69M12 3L2 12H5V20H11V14H13V20H19V12H22 </Geometry> <!--BASE PATH IMAGE BUTTON STYLE--> <Style x:Key="pathImageButtonStyle" TargetType="{x:Type mctrls:MaroisPathImageButton}"> <Setter Property="Background" Value="Transparent"/> <Setter Property="Height" Value="40"/> <Setter Property="Width" Value="65"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate> <Grid x:Name="Grid"> <Border x:Name="border" Margin="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" Bor
  • Report Designer Suggestions

    help
    3
    0 Votes
    3 Posts
    10 Views
    L
    I use a "designer" almost never. You spend 90% of the time getting the last 10% to look / work right (if ever). Writing custom reports isn't that hard if that's what you did before "designers". "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
  • Draw Images

    com design help question
    5
    0 Votes
    5 Posts
    14 Views
    P
    I normally just type XAML Path Icons in my window search bar. It opens from there for me. Advanced TypeScript Programming Projects