Monday, May 14, 2012

Silverlight: Binding Resource to DataGridTextColumn.Header

In the last two days, since it’s the end of our block I have decided to do some minor work (that way a check in won’t really effect the block). One of the changes I thought of was replacing all the free text in our Silverlight application with text from a resource file.

Everything worked like a charm except for the Header of DataGridTextColumn. My original Data Binding looked like this:

  1. <slData:DataGridTextColumn Header="{Binding Path=Type, Source={StaticResource StringsRes}}" Binding="{Binding Title}"/>

But the DataGrid columns in the application looked like this:

DataGrid-header-column-bug

In the end I found the solution here:

  1. <slData:DataGridTextColumn Binding="{Binding TypeString}" >
  2.     <sdk:DataGridTextColumn.HeaderStyle>
  3.         <Style TargetType="primitives:DataGridColumnHeader" >
  4.             <Setter Property="ContentTemplate">
  5.                 <Setter.Value>
  6.                     <DataTemplate>
  7.                         <TextBlock Text="{Binding Path=Type, Source={StaticResource StringsRes}}"/>
  8.                     </DataTemplate>
  9.                 </Setter.Value>
  10.             </Setter>
  11.         </Style>
  12.     </sdk:DataGridTextColumn.HeaderStyle>
  13. </slData:DataGridTextColumn>

Though I am still searching for a generic solution and not something I have to copy paste for each DataGrid Column…

 

//TODO: Check if this was fixed in SL5. If so post the elegant solution

IceRocket Tags:

Tuesday, May 1, 2012

Polyline wrong coordinates

We have been developing for a long time on a single oracle DB Server (Development stage) and recently added a new integration server. Because of time constraints we decided to just copy the data from the Dev server using SQL (out DBA did that part), and since we moved to SDO_GEOMETRY the data can be transferred without the use of ArcDesktop utilities.

So the data was moved correctly and the registration went without a glitch. But when we tried to create a new line in the layer its coordinates moved from (35.5, 32.7) (in x,y) to (–324.4, 32.7). The first thing I checked was my code but there were no changes done and in the old environment everything worked fine.

Looking at the Layers table in the SDE schema that table looked like:

EFLAGS

LAYER_MASK

GSIZE1

GSIZE2

GSIZE3

MINX

MINY

MAXX

MAXY

LAYER_CONFIG

138674317

128

-2

0 0

-400

-400

471.3916

471.3916

SDO_GEOMETRY

My first thought was that the –400 somehow affected the data being inserted but the same values were in the old DB and they worked.

After many actions of unregister and register of that layer the problem was solved.

 

TODO: Add table border, it looks bad in the site