RadGrid의 DetailTable 컬럼 크기 조절

 

ItemDataBound.... 이벤트에서.

 

//item["EMPTY"].Width = new Unit(75,UnitType.Pixel);    <--설정했지만 크기가 안변함.

//상부로 올려서 헤드를 설정해야 된다는..
item.OwnerTableView.GetColumn("EMPTY").HeaderStyle.Width = Unit.Pixel(75);

 

출처 :  https://www.telerik.com/forums/how-to-set-column-width-in-code-behind-for-detailtable

 

 

 

위에서 크기만 변경되고. Refresh 시.. 기본값으로 초기화됨.

ItemCreate 이벤트에서 설정해주어야함.

 

컬럼 전체가 되니..

DetailTable.KeyValue 로 구분하여..  처리해야함.

근데, 구분자가.. 다행히  ExpandCollapseColumn.Display 발생했던 문제였으므로,

이것으로 구분함. (문제발생한 부분이 구분값의 키구나..)

 

protected void rgClnDept_ItemCreated(object sender, GridItemEventArgs e)
 {
  if (e.Item is GridDataItem)
  {
   GridDataItem item = (GridDataItem)e.Item;

   string[] strKeyValue = item.KeyValues.ToString().Replace("{", "").Replace("}", "").Split(':');

   //키가없으면 기본항목
   if (strKeyValue.Length == 1)
   {

   }
   else if ("CntrNm".Equals(strKeyValue[0]))
   {
     if (!item.OwnerTableView.ExpandCollapseColumn.Display)
     {
      item.OwnerTableView.GetColumn("EMPTY").HeaderStyle.Width = Unit.Pixel(75);
     }
  }
  }
 }

 

출처 : https://www.telerik.com/forums/issue-hiding-detail-table-column-in-self-referencing-hierarchical-grid

 

 

Posted by 말없제이
,

구글의 RadPane .. SpeedRatio 관련으로 검색으로 비슷한유형

전혀 쓰지마란 얘기라서.

 

애니메이션을 찾아보니... Group 안에 넣어야 하는데

귀차니즘으로 그냥..그룹없이 애니메이션에 넣어도 적용됨..

 

TargetElementName="PopupChild" 는 Fixed(고정임)..

 

일부로 다른 오브젝트 elementName으로 넣었나..

타겟이 아닌 자기가 애니메이션 먹고있어씀. -= -

하부에 넣어도 안먹고, 지워서

snoop상에서 수정시 적용해 먹는거 보니..

명칭이 PopupChild 이였음 - -..

 

 

<telerik:RadDocking 
   x:Name="rdcDocking"
   BorderThickness="0"
   Padding="0"
   AllowUnsafeMode="True"
   Grid.Column="0"
   Grid.Row="0"
   >
    <telerik:AnimationManager.AnimationSelector>
     <telerik:AnimationSelector>
      <telerik:SlideAnimation
       AnimationName="LeftIn"
       Direction="In"
        Orientation="Horizontal"
       SpeedRatio="2"
        TargetElementName="PopupChild"
       >
      </telerik:SlideAnimation>
      <telerik:SlideAnimation
       AnimationName="LeftOut"
       Direction="Out"
       Orientation="Horizontal"
       SpeedRatio="2"
        TargetElementName="PopupChild"
       >
      </telerik:SlideAnimation>
     </telerik:AnimationSelector>
    </telerik:AnimationManager.AnimationSelector>
    <telerik:RadSplitContainer
    InitialPosition="DockedLeft"
    Width="450" >

.......

</ ... . .>

...

</ ... .>
    

Posted by 말없제이
,


[WPF] DataTemplate 안에서 ContextMenu의 바인딩

출처 : http://chanun.tistory.com/6
데이터 템플릿 안에있는 ContextMenu에, ViewModel에 있는 속성이나 커맨드 바인딩 방법중 하나 입니다.

1. ContextMenu를 갖게 되는 패널의 Tag속성에 ViewModel DataContext 바인딩
2. ContextMenu에 PlacementTarget.Tag 값을 DataContext로 지정한다.
3. MenuItem에 해당 Command 혹은 속성 바인딩

※ 동시에 DataTemplate의 DataContext나 그 속성을 사용해야 될경우 아래 CommandParameter 바인딩 처럼 구현하면 된다.

Xaml
<DataTemplate >
 <Grid Tag="{Binding Path=DataContext, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}">
  <Grid.ContextMenu>
   <ContextMenu DataContext="{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}" >
    <MenuItem
     Header="아이템1"
     Command="{Binding Item1Command}"
     CommandParameter="{Binding DataContext, RelativeSource={RelativeSource TemplatedParent}}"
     />
    <MenuItem
     Header="아이템2"
     Command="{Binding Item2Command}"
     CommandParameter="{Binding DataContext, RelativeSource={RelativeSource TemplatedParent}}"
     />
   </ContextMenu>
  </Grid.ContextMenu>
 </Grid>
</DataTemplate>

※ ContextMenu.PlacementTarget 
ContextMenu가 열리는 위치의 기준이 되는 UIElement를 가져오거나 설정합니다. 이 속성은 종속성 속성입니다.

 

위에서 전체말고 바로상위단 선택값 파라메타 값 넘김.

출처 : http://stackoverflow.com/questions/8154202/pass-command-parameter-from-the-xaml

 ...
CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}, Path=PlacementTarget.SelectedItem}"

Posted by 말없제이
,

간단한것이 MVVM패턴에서는 바로 안먹혀서. 요리 조리 하다 시간 많이 걸림.


구글 검색 참조 : http://stackoverflow.com/questions/12540457/moving-an-item-up-and-down-in-a-wpf-list-box

//-- CS
private void btnUp_Click(object sender, EventArgs e)     
{     
if (radListBox1.SelectedIndex > 0)     
{     
int index = radListBox1.SelectedIndex;     
RadListBoxItem current = radListBox1.SelectedItem as RadListBoxItem;     
radListBox1.Items.Remove(current);     
radListBox1.Items.Insert(index - 1, current);     
radListBox1.SelectedIndex = index - 1;     
}     
}     

private void btnDown_Click(object sender, EventArgs e)     
{     
if ((radListBox1.SelectedIndex > -1) && (radListBox1.SelectedIndex < radListBox1.Items.Count - 1))     
{     
int index = radListBox1.SelectedIndex;     
RadListBoxItem current = radListBox1.SelectedItem as RadListBoxItem;     
radListBox1.Items.Remove(current);     
radListBox1.Items.Insert(index + 1, current);     
radListBox1.SelectedIndex = index + 1;     
}     
}    

 

//맞도록 변경해보장

//MVVM 패턴일경우 radListBox1.Items.Remove 요기서 ItemsSource 잡혀있어서 못쓴다고 날리다.
//MVVM에 맞게 수정 - 어언 7년전 C#에서 var 쓴다고 욕들먹은은 1인.

//-- XMAL
<Button
DockPanel.Dock="Top"
Content="▽"
Width="18"
Height="18"
Margin="0,0,0,5"
Command="{Binding DataContext.SltGrpItemDown, RelativeSource = {RelativeSource AncestorType={x:Type telerik:RadTabControl},AncestorLevel=2}}"
CommandParameter="{Binding ElementName=Model1SelectValue}"
/>
<telerik:RadListBox
Name="Model1SelectValue"
DockPanel.Dock="Right"
Margin="10,3,3,3"
ItemsSource="{Binding IChildSelection}"
>

//-- ViewModel
/// <summary>
/// 그룹들 위로 올리기
/// </summary>
public void OnSltGrpItemUp(object param)
{
//빈값이거나 타입값이 아니면 취소.
if (param == null) return;

var vrParam = (Telerik.Windows.Controls.RadListBox)param;

var vrCllct = vrParam.ItemsSource as Collection<DBSelections>;
var vrSlct = vrParam.SelectedItem;

if (vrSlct == null)
{
System.Windows.MessageBox.Show("항목을 선택하세요.");
return;
}

if (vrParam.SelectedIndex > 0)
{
int index = vrParam.SelectedIndex;
vrCllct.Remove(vrSlct);
vrCllct.Insert(index - 1, vrSlct);
vrParam.SelectedIndex = index - 1;
}

}

/// <summary>
/// 그룹들 아래로 내리기
/// </summary>
public void OnSltGrpItemDown(object param)
{
//빈값이거나 타입값이 아니면 취소.
if (param == null) return;

var vrParam = (Telerik.Windows.Controls.RadListBox)param;

var vrCllct = vrParam.ItemsSource as Collection<DBSelections>;
var vrSlct = vrParam.SelectedItem;

if (vrSlct == null)
{
System.Windows.MessageBox.Show("항목을 선택하세요.");
return;
}

if ((vrParam.SelectedIndex > -1) && (vrParam.SelectedIndex < vrParam.Items.Count - 1))     
{
int index = vrParam.SelectedIndex;
vrCllct.Remove(vrSlct);
vrCllct.Insert(index + 1, vrSlct);
vrParam.SelectedIndex = index + 1;
}

}

Posted by 말없제이
,

RadGrid(Telerik Web버전) Min Header

익스플러워 크기 변경시에도 최소 크기 보장? 안된다 - -

4일 걸렸음 - -. 웹페이지 크기에 따라 크기 줄이기도해보기도 했으나  --

 

HeaderStyle-Width에 그흔한 Min-Width 가 없다 -- "*"넣으면.. 당연히 에러 --

 

그러면 최소 크기 보장위해 2개 컬럼 생성. 100px 그리고 100%.

두개를 연결하면 최소 크기 보장됨.

다만 두개 머지시켜줘야함..

아이템은 잘나오나 .

헤더는.. 버그가 있음- -

 

그래서 PreRender에서 수정.

protected void rgClnCenter_PreRender(object sender, EventArgs e)
 {

 #region // 렌더링시 체크
  if (sender is RadGrid)
  {
   try
   {
    var vrMtv = ((RadGrid)sender).MasterTableView.Items;

    foreach (var vrIn in vrMtv)
    {
     string strV = vrIn.GetType().ToString();

     if (vrIn is GridDataItem)
     {
      ((GridDataItem)vrIn)["DeptNmCom"].ColumnSpan = 2;
      ((GridDataItem)vrIn)["DeptNmSpan"].Visible = false;
     }
    }
   }
   catch
   { }
  }

GridItem[] groupHeaders = ((RadGrid)sender).MasterTableView.GetItems(GridItemType.Header);

  //헤더중 첫줄만 적용. 헤더가 멀티로 2줄입니다. 1줄일경우 RowSpan 사용안하심 됩니다.
  int iRow = 0;
  foreach (GridItem item in groupHeaders)
  {
   GridHeaderItem header = (GridHeaderItem)item;
   try
   {
    if (iRow == 0)
    {
     header["DeptNmCom"].ColumnSpan = 2; //헤더 2개를 머지
     header["DeptNmSpan"].RowSpan = 2; //로 머지 안하면 뒤쪽에 줄이 밀려보여줌. 헤더가 멀티로 2줄이여서 ^^
     header["DeptNmSpan"].Attributes.Add("style", "display:none;"); //화면에서 보이지 않도록 스타일 줌.. Visible주면 깨져 보임. --
    }
    iRow++;
   }
   catch
   {}
  }

#endregion
 }

 적용전 ..  윈도우 익스플로러 최소 일경우 "진료과"가 안보임

 

적용후 ... 윈도우 익스플로러 최소 일경우도 "진료과"가 보임

최대로 늘릴경우 크기가 늘어남.

 

 

 

 

 

Posted by 말없제이
,

<telerik:RadAjaxLoadingPanel
        ID="RadAjaxLoadingPanel1"
        runat="server"
        Overlay="true"
        Transparency="10"
        >
        <div style="position: fixed; top: 0px; left: 0px; z-index: 98; height: 100%; width: 100%; background-color: black; opacity: 0.4; filter: alpha(opacity=40)">
        </div>
        <div style="position: absolute; top:20%; left: 0px; z-index: 99;height: 100%; width: 100%; ">
            <asp:Image ID="LoadImg" runat="server" ImageUrl="../image/hr_edu/loding2.gif" />
        </div> 
    </telerik:RadAjaxLoadingPanel>

Posted by 말없제이
,

<telerik:GridViewDataColumn Header="부서" Width="150" DataMemberBinding="{Binding DptLstNm}" IsReadOnly="True" >
                                <telerik:GridViewDataColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Name="btnDeptPop" Margin="2,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"
                                                Command="{Binding DataContext.ShowAuthDept, RelativeSource = {RelativeSource AncestorType={x:Type telerik:RadGridView}}}"
                                                CommandParameter="{Binding AuthSeq}" >
                                            <StackPanel>
                                                <Image Source="../IMG/Search.GIF" Height="17" />
                                            </StackPanel>
                                        </Button>
                                    </DataTemplate>
                                </telerik:GridViewDataColumn.CellTemplate>
                            </telerik:GridViewDataColumn>

Posted by 말없제이
,

 

Posted by 말없제이
,


 <!--
웹사이트 Web.config 파일내에 ..
아래 설정이 되어있어야, DataGrid시 에러발생안함
발생유형 : 500건이상 조회후 재조회시 아래 오류발생
[InvalidOperationException: 개체의 현재 상태 때문에 작업이 유효하지 않습니다.]
   System.Web.HttpValueCollection.ThrowIfMaxHttpCollectionKeysExceeded() +2421022

   처리 : MaxHttpCollectionKeys 크기를 10만건으로 수정 (업체 최대시 18,000여건 발생)
-->
<appSettings>
 <!-- 그리드 크기 조절 보통 500건 넘어가면 에러발생으로 크기 조정. 2013.01.02 -->
 <add key="aspnet:MaxHttpCollectionKeys" value="100000" />
</appSettings>

 

Posted by 말없제이
,
UltraWebGrid 설명문서_NA2004_Vol2
Posted by 말없제이
,