Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. Convert xaml to C#

Convert xaml to C#

Scheduled Pinned Locked Moved WPF
wpfcsharpwcf
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 10467872
    wrote on last edited by
    #1

    Hello, Please can someone convert me the following xaml code to C# code:

    <DataGridTextColumn Header="Ordinal" IsReadOnly="True">
    <DataGridTextColumn.Binding>
    <MultiBinding
    Converter="{StaticResource rowNumberConverter}">
    <Binding />
    <Binding
    RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}" />
    </MultiBinding>
    </DataGridTextColumn.Binding>
    </DataGridTextColumn>

    B 1 Reply Last reply
    0
    • U User 10467872

      Hello, Please can someone convert me the following xaml code to C# code:

      <DataGridTextColumn Header="Ordinal" IsReadOnly="True">
      <DataGridTextColumn.Binding>
      <MultiBinding
      Converter="{StaticResource rowNumberConverter}">
      <Binding />
      <Binding
      RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type DataGrid}}" />
      </MultiBinding>
      </DataGridTextColumn.Binding>
      </DataGridTextColumn>

      B Offline
      B Offline
      BenScharbach
      wrote on last edited by
      #2

      I think the best thing to do is to convert the xaml headers, like DataGridTextColumn to equivalent classes in C#. The red items in xaml are the properties for that class. For example, the Header and IsReadOnly is most likely in the original DataGridTextColumn class as additional properties. Most xaml headers can be located as similar class names. Finally, the binding could be changed to reference the DataGrid's name instead.

      Ben Scharbach Temporalwars.Com YouTube:Ben Scharbach

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups