1

I need to find string format from XAML binding in code. Lets say I have data grid where one of the columns is:

<sdk:DataGridTextColumn Header="DD" Binding="{Binding Field4, StringFormat=d}" />

I can access the field name like this:

dg.Columns
    .OfType<DataGridBoundColumn>()
    .Select(i => (i as DataGridBoundColumn).Binding.Path.Path)

Is there a way to access string format "d" ?

1 Answer 1

2

Try this

dg.Columns
    .OfType<DataGridBoundColumn>()
    .Select(i => (i as DataGridBoundColumn).Binding.StringFormat)
Sign up to request clarification or add additional context in comments.

1 Comment

its unreal! I crawled all other the Binding object in debugger for 20 min and couldnt see the obvious!! thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.